File: typeArgInferenceWithNull.symbols

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (41 lines) | stat: -rw-r--r-- 1,927 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
=== 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))