swc/crates/swc_ecma_parser/tests/tsc/validUndefinedAssignments.ts

23 lines
303 B
TypeScript
Raw Normal View History

var x: typeof undefined;
var a: number = x;
var b: boolean = x;
var c: string = x;
var d: void = x;
var e: typeof undefined = x;
e = x; // should work
class C { foo: string }
var f: C;
f = x;
interface I { foo: string }
var g: I;
g = x;
var h: { f(): void } = x;
function i<T>(a: T) {
a = x;
}