class C {x!}
class C {x! = 1}
> require('oxc-parser').parseSync('1.ts','class A {x!}',{}).errors
[
{
severity: 'Error',
message: 'Declarations with definite assignment assertions must also have type annotations.',
labels: [ [Object] ],
helpMessage: null,
codeframe: '\n' +
' x TS(1264): Declarations with definite assignment assertions must also have\n' +
' | type annotations.\n' +
' ,-[1.ts:1:11]\n' +
' 1 | class A {x!}\n' +
' : ^\n' +
' `----\n'
}
]
> require('oxc-parser').parseSync('1.ts','class A {x! = 1}',{}).errors
[
{
severity: 'Error',
message: 'Declarations with initializers cannot also have definite assignment assertions.',
labels: [ [Object] ],
helpMessage: null,
codeframe: '\n' +
' x TS(1263): Declarations with initializers cannot also have definite\n' +
' | assignment assertions.\n' +
' ,-[1.ts:1:11]\n' +
' 1 | class A {x! = 1}\n' +
' : ^\n' +
' `----\n'
}
]
We already reject these
Not sure how to get the error in the playground, but
But currently these are allowed
and