javascript-decorators

Error: Set the experimentalDecorators option to remove this warning

风流意气都作罢 提交于 2019-12-24 13:44:13
问题 I'm using Cypress version 3.3.1. I'm getting the following error: Error: "TS1219: Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option to remove this warning." PS: I've set "experimentalDecorators": true in tsconfig.json . Tried the following but it didn't work: https://github.com/cypress-io/eslint-plugin-dev/issues/4 Code where the error is being reported: @observable public someVar: dataType; 回答1: I created

Decorators on functions

纵饮孤独 提交于 2019-12-20 09:46:23
问题 I see that babel.js decorators (available in "stage 1") implement the spec at https://github.com/wycats/javascript-decorators. It appears that decorators are limited to (1) classes, (2) accessors, and (3) methods. In my case, I want to use decorators on plain old functions , as in @chainable function foo() { } where (just an example) function chainable(fn) { return function() { fn.apply(this, arguments); return this; }; } I don't see any logical reason why decorators should not be able to

How can I use decorators today?

天大地大妈咪最大 提交于 2019-12-03 15:14:27
问题 I see decorators being used today already in some javascript code. My question is really two fold. First: If decorators have not even been finalized how is it possible to use them in production code, today? Won't browser support be non-existent? Second: Given it is possible to use it today, as some open source projects would suggest, what's a typically recommended setup for getting decorators to work? 回答1: You're right, ES2016 decorators are not yet part of the spec. But it doesn't mean we

How can I use decorators today?

≯℡__Kan透↙ 提交于 2019-12-03 04:51:35
I see decorators being used today already in some javascript code. My question is really two fold. First: If decorators have not even been finalized how is it possible to use them in production code, today? Won't browser support be non-existent? Second: Given it is possible to use it today, as some open source projects would suggest, what's a typically recommended setup for getting decorators to work? You're right, ES2016 decorators are not yet part of the spec. But it doesn't mean we can't use it today. First let's take a step back and go over "what is a decorator". Decorators are simply

Decorators on functions

三世轮回 提交于 2019-12-02 20:01:54
I see that babel.js decorators (available in "stage 1") implement the spec at https://github.com/wycats/javascript-decorators . It appears that decorators are limited to (1) classes, (2) accessors, and (3) methods. In my case, I want to use decorators on plain old functions , as in @chainable function foo() { } where (just an example) function chainable(fn) { return function() { fn.apply(this, arguments); return this; }; } I don't see any logical reason why decorators should not be able to apply to functions. My question is, is there some way to accomplish this? Or is there some good reason