I found something that I think is really strange. A !
inside an object
interface MyObj {
a?: string,
b: number
}
const toto: string = "test";
const obj: MyObj = {
a: toto!,
b: 0
}
I can't figure out what is the toto!
I found something that I think is really strange. A !
inside an object
interface MyObj {
a?: string,
b: number
}
const toto: string = "test";
const obj: MyObj = {
a: toto!,
b: 0
}
I can't figure out what is the toto!
A new ! post-fix expression operator may be used to assert that its operand is non-null and non-undefined in contexts where the type checker is unable to conclude that fact. Specifically, the operation x! produces a value of the type of x with null and undefined excluded. See here