1
- noInfer.ts(29 ,13): error TS2345: Argument of type '"bar"' is not assignable to parameter of type '"foo"'.
2
- noInfer.ts(30 ,14): error TS2322: Type '"bar"' is not assignable to type '"foo"'.
3
- noInfer.ts(31 ,14): error TS2322: Type '"bar"' is not assignable to type '"foo"'.
4
- noInfer.ts(32 ,15): error TS2322: Type '"bar"' is not assignable to type '"foo"'.
5
- noInfer.ts(33 ,15): error TS2322: Type '"bar"' is not assignable to type '"foo"'.
6
- noInfer.ts(41 ,30): error TS2741: Property 'woof' is missing in type 'Animal' but required in type 'Dog'.
7
- noInfer.ts(47 ,16): error TS2345: Argument of type '{ x: number; }' is not assignable to parameter of type '{ x: number; y: number; }'.
1
+ noInfer.ts(35 ,13): error TS2345: Argument of type '"bar"' is not assignable to parameter of type '"foo"'.
2
+ noInfer.ts(36 ,14): error TS2322: Type '"bar"' is not assignable to type '"foo"'.
3
+ noInfer.ts(37 ,14): error TS2322: Type '"bar"' is not assignable to type '"foo"'.
4
+ noInfer.ts(38 ,15): error TS2322: Type '"bar"' is not assignable to type '"foo"'.
5
+ noInfer.ts(39 ,15): error TS2322: Type '"bar"' is not assignable to type '"foo"'.
6
+ noInfer.ts(47 ,30): error TS2741: Property 'woof' is missing in type 'Animal' but required in type 'Dog'.
7
+ noInfer.ts(53 ,16): error TS2345: Argument of type '{ x: number; }' is not assignable to parameter of type '{ x: number; y: number; }'.
8
8
Property 'y' is missing in type '{ x: number; }' but required in type '{ x: number; y: number; }'.
9
- noInfer.ts(52 ,22): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; }'.
10
- noInfer.ts(53 ,14): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; }'.
11
- noInfer.ts(60 ,14): error TS2345: Argument of type '{}' is not assignable to parameter of type '{ foo: number; }'.
9
+ noInfer.ts(58 ,22): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; }'.
10
+ noInfer.ts(59 ,14): error TS2353: Object literal may only specify known properties, and 'y' does not exist in type '{ x: number; }'.
11
+ noInfer.ts(66 ,14): error TS2345: Argument of type '{}' is not assignable to parameter of type '{ foo: number; }'.
12
12
Property 'foo' is missing in type '{}' but required in type '{ foo: number; }'.
13
13
14
14
@@ -34,6 +34,12 @@ noInfer.ts(60,14): error TS2345: Argument of type '{}' is not assignable to para
34
34
type T21<T> = NoInfer<NoInfer<T> & string>;
35
35
type T22<T> = NoInfer<NoInfer<T> & string[]>;
36
36
37
+ // NoInfer<T> is erased in index types and mapped types
38
+
39
+ type T30 = keyof NoInfer<{ a: string, b: string }>;
40
+ type T31<T> = keyof NoInfer<T>;
41
+ type T32 = { [K in keyof NoInfer<{ a: string, b: string }>]: K };
42
+
37
43
declare function foo1<T extends string>(a: T, b: NoInfer<T>): void
38
44
declare function foo2<T extends string>(a: T, b: NoInfer<T>[]): void
39
45
declare function foo3<T extends string>(a: T, b: NoInfer<T[]>): void
@@ -53,11 +59,11 @@ noInfer.ts(60,14): error TS2345: Argument of type '{}' is not assignable to para
53
59
foo4('foo', { x: 'bar' }) // error
54
60
~
55
61
!!! error TS2322: Type '"bar"' is not assignable to type '"foo"'.
56
- !!! related TS6500 noInfer.ts:25 :52: The expected type comes from property 'x' which is declared here on type '{ x: "foo"; }'
62
+ !!! related TS6500 noInfer.ts:31 :52: The expected type comes from property 'x' which is declared here on type '{ x: "foo"; }'
57
63
foo5('foo', { x: 'bar' }) // error
58
64
~
59
65
!!! error TS2322: Type '"bar"' is not assignable to type '"foo"'.
60
- !!! related TS6500 noInfer.ts:26 :60: The expected type comes from property 'x' which is declared here on type 'NoInfer<{ x: "foo"; }>'
66
+ !!! related TS6500 noInfer.ts:32 :60: The expected type comes from property 'x' which is declared here on type 'NoInfer<{ x: "foo"; }>'
61
67
62
68
declare class Animal { move(): void }
63
69
declare class Dog extends Animal { woof(): void }
@@ -68,8 +74,8 @@ noInfer.ts(60,14): error TS2345: Argument of type '{}' is not assignable to para
68
74
doSomething(new Dog(), () => new Animal()); // error
69
75
~~~~~~~~~~~~
70
76
!!! error TS2741: Property 'woof' is missing in type 'Animal' but required in type 'Dog'.
71
- !!! related TS2728 noInfer.ts:36 :36: 'woof' is declared here.
72
- !!! related TS6502 noInfer.ts:37 :55: The expected type comes from the return type of this signature.
77
+ !!! related TS2728 noInfer.ts:42 :36: 'woof' is declared here.
78
+ !!! related TS6502 noInfer.ts:43 :55: The expected type comes from the return type of this signature.
73
79
74
80
declare function assertEqual<T>(actual: T, expected: NoInfer<T>): boolean;
75
81
@@ -79,7 +85,7 @@ noInfer.ts(60,14): error TS2345: Argument of type '{}' is not assignable to para
79
85
~~~~~~~~
80
86
!!! error TS2345: Argument of type '{ x: number; }' is not assignable to parameter of type '{ x: number; y: number; }'.
81
87
!!! error TS2345: Property 'y' is missing in type '{ x: number; }' but required in type '{ x: number; y: number; }'.
82
- !!! related TS2728 noInfer.ts:46 :19: 'y' is declared here.
88
+ !!! related TS2728 noInfer.ts:52 :19: 'y' is declared here.
83
89
84
90
declare function invoke<T, R>(func: (value: T) => R, value: NoInfer<T>): R;
85
91
declare function test(value: { x: number; }): number;
@@ -100,7 +106,7 @@ noInfer.ts(60,14): error TS2345: Argument of type '{}' is not assignable to para
100
106
~~
101
107
!!! error TS2345: Argument of type '{}' is not assignable to parameter of type '{ foo: number; }'.
102
108
!!! error TS2345: Property 'foo' is missing in type '{}' but required in type '{ foo: number; }'.
103
- !!! related TS2728 noInfer.ts:57 :33: 'foo' is declared here.
109
+ !!! related TS2728 noInfer.ts:63 :33: 'foo' is declared here.
104
110
105
111
declare function mutate<T>(callback: (a: NoInfer<T>, b: number) => T): T;
106
112
const mutate1 = mutate((a, b) => b);
0 commit comments