41 lines
1.9 KiB
Text
41 lines
1.9 KiB
Text
=== tests/cases/compiler/typeArgInferenceWithNull.ts ===
|
|
// All legal
|
|
|
|
function fn4<T extends string>(n: T) { }
|
|
>fn4 : Symbol(fn4, Decl(typeArgInferenceWithNull.ts, 0, 0))
|
|
>T : Symbol(T, Decl(typeArgInferenceWithNull.ts, 2, 13))
|
|
>n : Symbol(n, Decl(typeArgInferenceWithNull.ts, 2, 31))
|
|
>T : Symbol(T, Decl(typeArgInferenceWithNull.ts, 2, 13))
|
|
|
|
fn4(null);
|
|
>fn4 : Symbol(fn4, Decl(typeArgInferenceWithNull.ts, 0, 0))
|
|
|
|
function fn5<T extends { x: string }>(n: T) { }
|
|
>fn5 : Symbol(fn5, Decl(typeArgInferenceWithNull.ts, 3, 10))
|
|
>T : Symbol(T, Decl(typeArgInferenceWithNull.ts, 5, 13))
|
|
>x : Symbol(x, Decl(typeArgInferenceWithNull.ts, 5, 24))
|
|
>n : Symbol(n, Decl(typeArgInferenceWithNull.ts, 5, 38))
|
|
>T : Symbol(T, Decl(typeArgInferenceWithNull.ts, 5, 13))
|
|
|
|
fn5({ x: null });
|
|
>fn5 : Symbol(fn5, Decl(typeArgInferenceWithNull.ts, 3, 10))
|
|
>x : Symbol(x, Decl(typeArgInferenceWithNull.ts, 6, 5))
|
|
|
|
function fn6<T extends { x: string }>(n: T, fun: (x: T) => void, n2: T) { }
|
|
>fn6 : Symbol(fn6, Decl(typeArgInferenceWithNull.ts, 6, 17))
|
|
>T : Symbol(T, Decl(typeArgInferenceWithNull.ts, 8, 13))
|
|
>x : Symbol(x, Decl(typeArgInferenceWithNull.ts, 8, 24))
|
|
>n : Symbol(n, Decl(typeArgInferenceWithNull.ts, 8, 38))
|
|
>T : Symbol(T, Decl(typeArgInferenceWithNull.ts, 8, 13))
|
|
>fun : Symbol(fun, Decl(typeArgInferenceWithNull.ts, 8, 43))
|
|
>x : Symbol(x, Decl(typeArgInferenceWithNull.ts, 8, 50))
|
|
>T : Symbol(T, Decl(typeArgInferenceWithNull.ts, 8, 13))
|
|
>n2 : Symbol(n2, Decl(typeArgInferenceWithNull.ts, 8, 64))
|
|
>T : Symbol(T, Decl(typeArgInferenceWithNull.ts, 8, 13))
|
|
|
|
fn6({ x: null }, y => { }, { x: "" }); // y has type { x: any }, but ideally would have type { x: string }
|
|
>fn6 : Symbol(fn6, Decl(typeArgInferenceWithNull.ts, 6, 17))
|
|
>x : Symbol(x, Decl(typeArgInferenceWithNull.ts, 9, 5))
|
|
>y : Symbol(y, Decl(typeArgInferenceWithNull.ts, 9, 16))
|
|
>x : Symbol(x, Decl(typeArgInferenceWithNull.ts, 9, 28))
|
|
|