forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathexpressionWithJSDocTypeArguments.types
86 lines (66 loc) · 2.47 KB
/
expressionWithJSDocTypeArguments.types
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
=== tests/cases/compiler/expressionWithJSDocTypeArguments.ts ===
// Repro from #51802
function foo<T>(x: T): T { return x }
>foo : <T>(x: T) => T
>x : T
>x : T
class Bar<T> { constructor(public x: T) { } }
>Bar : Bar<T>
>x : T
// Errors expected on all of the following
const WhatFoo = foo<?>;
>WhatFoo : (x: any) => any
>foo<?> : (x: any) => any
>foo : <T>(x: T) => T
const HuhFoo = foo<string?>;
>HuhFoo : (x: string | null) => string | null
>foo<string?> : (x: string | null) => string | null
>foo : <T>(x: T) => T
const NopeFoo = foo<?string>;
>NopeFoo : (x: string | null) => string | null
>foo<?string> : (x: string | null) => string | null
>foo : <T>(x: T) => T
const ComeOnFoo = foo<?string?>;
>ComeOnFoo : (x: string | null) => string | null
>foo<?string?> : (x: string | null) => string | null
>foo : <T>(x: T) => T
type TWhatFoo = typeof foo<?>;
>TWhatFoo : typeof foo<unknown>
>foo : <T>(x: T) => T
type THuhFoo = typeof foo<string?>;
>THuhFoo : typeof foo<string | null>
>foo : <T>(x: T) => T
type TNopeFoo = typeof foo<?string>;
>TNopeFoo : typeof foo<string | null>
>foo : <T>(x: T) => T
type TComeOnFoo = typeof foo<?string?>;
>TComeOnFoo : typeof foo<(string | null) | null>
>foo : <T>(x: T) => T
const WhatBar = Bar<?>;
>WhatBar : { new (x: any): Bar<any>; prototype: Bar<unknown>; }
>Bar<?> : { new (x: any): Bar<any>; prototype: Bar<unknown>; }
>Bar : typeof Bar
const HuhBar = Bar<string?>;
>HuhBar : { new (x: string | null): Bar<string | null>; prototype: Bar<unknown>; }
>Bar<string?> : { new (x: string | null): Bar<string | null>; prototype: Bar<unknown>; }
>Bar : typeof Bar
const NopeBar = Bar<?string>;
>NopeBar : { new (x: string | null): Bar<string | null>; prototype: Bar<unknown>; }
>Bar<?string> : { new (x: string | null): Bar<string | null>; prototype: Bar<unknown>; }
>Bar : typeof Bar
const ComeOnBar = Bar<?string?>;
>ComeOnBar : { new (x: string | null): Bar<string | null>; prototype: Bar<unknown>; }
>Bar<?string?> : { new (x: string | null): Bar<string | null>; prototype: Bar<unknown>; }
>Bar : typeof Bar
type TWhatBar = typeof Bar<?>;
>TWhatBar : typeof Bar<unknown>
>Bar : typeof Bar
type THuhBar = typeof Bar<string?>;
>THuhBar : typeof Bar<string | null>
>Bar : typeof Bar
type TNopeBar = typeof Bar<?string>;
>TNopeBar : typeof Bar<string | null>
>Bar : typeof Bar
type TComeOnBar = typeof Bar<?string?>;
>TComeOnBar : typeof Bar<(string | null) | null>
>Bar : typeof Bar