New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhancement: add experimentalDecorators
option to typescript-estree
#6571
Comments
Is there a syntax difference between the two of them, or just a semantic difference? If it's the former, then we can look into it. |
There is syntax difference between the two of them. For example, the following decorator is valid as experimental decorators, but is invalid as ES decorators. declare const special: any;
class Foo {
bar(@special(true) { bar }: any) {}
} |
Sorry - to clarify I meant semantic/syntactic in the TS sense, i.e. for a syntactic error the TS parser would hard-error, but for a semantic error the parser does not error (but TS itself will emit an error). Looking at your example - the decorator positioning is (currently at least) a semantic error, not a syntactic one. I think us just supporting everything and having TS semantically error on the user's code is the best course of action for now - over time TS will remove the experimental flag and we'll stop parsing it naturally. |
@bradzacher Ah I got it, thank you. So what do you think about #6570 (comment)? Should we default this option to |
Before You File a Proposal Please Confirm You Have Done The Following...
Relevant Package
typescript-estree
My proposal is suitable for this project
Description
What:
Adds
experimentalDecorators
option to@typescript-eslint/typescript-estree
.It just corresponds to
experimentalDecorators
in TS compiler options.Why:
Since TypeScript 5.0, ECMAScript decorators are implemented; we can switch between them using
experimantalDecortors
in the compiler options.There is no way to switch it on in
typescript-estree
except by specifyingtsconfig.json
byproject
.It would be helpful to have
experimentalDecorators
as a parsing option, like the already existingjsx
option.Fail
// N/A
Pass
// N/A
Additional Info
I think we can avoid breaking changes by setting the default value of this option to
true
. (And, we can change it tofalse
at next major version)The text was updated successfully, but these errors were encountered: