In my TypeScript class, why does this fail:
export class MyClass {
x:string = null //throws IDE warning (type 'null' is not assignable to 'String')
}
but this works:
export class MyClass {
x:string = null!
}
I don't understand what null! even is. A guaranteed-to-be-not-null null?
never(which would not be assignable). Same thing here:const y = 5 as never; const x: string = y;doesn't error