-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Closed
Labels
ASTPRs and Issues about the AST structurePRs and Issues about the AST structureenhancementNew feature or requestNew feature or requestlocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: typescript-estreeIssues related to @typescript-eslint/typescript-estreeIssues related to @typescript-eslint/typescript-estree
Description
Suggestion
In #9211: we are planning to enforce the following invariants in our AST for VariableDeclaration, specifically the declarators in declarations:
definitecan only be true ifdeclare: falseandkind: "let" | "var", so the following are all parsing errors:const x! = 1; declare let x!: string;
- If
definite: true, theninit: null, and the identifier has a type annotation:let x! = 1; let x!;
- If
declare: trueandkind: "let" | "var", theninit: null:declare let x = 1;
- If
declare: falseandkind: "const"theninitis non-null:const x;
@sosukesuzuki @fisker Do these look safe to you?
Metadata
Metadata
Assignees
Labels
ASTPRs and Issues about the AST structurePRs and Issues about the AST structureenhancementNew feature or requestNew feature or requestlocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: typescript-estreeIssues related to @typescript-eslint/typescript-estreeIssues related to @typescript-eslint/typescript-estree