TypeScript/tests/cases/compiler/voidIsInitialized.ts
2019-09-11 00:02:39 +01:00

13 lines
222 B
TypeScript

// @strict: true
const x: void = undefined;
const y: void = undefined;
if(typeof x === "undefined") {
x // no error: assume x2 is initialised
}
if(typeof y !== "undefined") {
y // no error: do not narrow void
}