add tests for generic type argument under strict null checks

This commit is contained in:
Herrington Darkholme
2016-11-26 13:19:04 +08:00
parent c19221cb3e
commit 186ce38c18
6 changed files with 97 additions and 2 deletions

View File

@@ -20,3 +20,16 @@ bound2<{}>();
bound2<Object>();
bound2<number>(); // expect error
bound2<string>(); // expect error
interface Proxy<T extends object> {}
var x: Proxy<number>; // error
var y: Proxy<null>; // ok
var z: Proxy<undefined> ; // ok
interface Blah {
foo: number;
}
var u: Proxy<Blah>; // ok

View File

@@ -47,3 +47,15 @@ if (typeof d === 'undefined') {
} else {
d.toString(); // error, object | null
}
interface Proxy<T extends object> {}
var x: Proxy<number>; // error
var y: Proxy<null>; // error
var z: Proxy<undefined>; // error
interface Blah {
foo: number;
}
var u: Proxy<Blah>; // ok