Recast version: 0.20.5
Node version: 14.18.2
Mac OS X version: 12.0.1
Repro: https://github.com/lokshunhung/recast-definite-repro
AST explorer
recast with recast/parser/typescript can remove definite assignment assertions for class properties by setting ClassProperty.definite = false (originally true)
// Before
class A {
foo!: string;
}
// After
class A {
foo: string;
}
but cannot add definite assignment assertions for class properties by setting ClassProperty.definite = true (originally undefined)
// Before
class A {
foo: string;
}
// After
class A {
foo: string;
}
// should be `foo!: string;`
Recast version:
0.20.5Node version:
14.18.2Mac OS X version:
12.0.1Repro: https://github.com/lokshunhung/recast-definite-repro
AST explorer
recastwithrecast/parser/typescriptcan remove definite assignment assertions for class properties by settingClassProperty.definite = false(originallytrue)but cannot add definite assignment assertions for class properties by setting
ClassProperty.definite = true(originallyundefined)