mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
add tests for generic type argument under strict null checks
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user