Open Josh-Cena opened 3 weeks ago
In https://github.com/typescript-eslint/typescript-eslint/pull/9211: we are planning to enforce the following invariants in our AST for VariableDeclaration, specifically the declarators in declarations:
VariableDeclaration
declarations
definite
declare: false
kind: "let" | "var"
const x! = 1; declare let x!: string;
definite: true
init: null
let x! = 1; let x!;
declare: true
declare let x = 1;
kind: "const"
init
const x;
@sosukesuzuki @fisker Do these look safe to you?
Do these look safe to you?
I don't think Prettier really care, should be safe to us.
Suggestion
In https://github.com/typescript-eslint/typescript-eslint/pull/9211: we are planning to enforce the following invariants in our AST for
VariableDeclaration
, specifically the declarators indeclarations
:definite
can only be true ifdeclare: false
andkind: "let" | "var"
, so the following are all parsing errors:definite: true
, theninit: null
, and the identifier has a type annotation:declare: true
andkind: "let" | "var"
, theninit: null
:declare: false
andkind: "const"
theninit
is non-null:@sosukesuzuki @fisker Do these look safe to you?