Skip to content

Commit 36a49ad

Browse files
committed
Accept new baselines
1 parent afec056 commit 36a49ad

4 files changed

Lines changed: 71 additions & 101 deletions

File tree

tests/baselines/reference/inferTypes1.errors.txt

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,17 @@ tests/cases/conformance/types/conditional/inferTypes1.ts(34,23): error TS2344: T
22
tests/cases/conformance/types/conditional/inferTypes1.ts(43,25): error TS2344: Type '(x: string, y: string) => number' does not satisfy the constraint '(x: any) => any'.
33
tests/cases/conformance/types/conditional/inferTypes1.ts(44,25): error TS2344: Type 'Function' does not satisfy the constraint '(x: any) => any'.
44
Type 'Function' provides no match for the signature '(x: any): any'.
5+
tests/cases/conformance/types/conditional/inferTypes1.ts(70,12): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
6+
tests/cases/conformance/types/conditional/inferTypes1.ts(71,15): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
7+
tests/cases/conformance/types/conditional/inferTypes1.ts(71,41): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
8+
tests/cases/conformance/types/conditional/inferTypes1.ts(71,51): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
9+
tests/cases/conformance/types/conditional/inferTypes1.ts(72,15): error TS2304: Cannot find name 'U'.
10+
tests/cases/conformance/types/conditional/inferTypes1.ts(72,15): error TS4081: Exported type alias 'T62' has or is using private name 'U'.
11+
tests/cases/conformance/types/conditional/inferTypes1.ts(72,43): error TS2304: Cannot find name 'U'.
12+
tests/cases/conformance/types/conditional/inferTypes1.ts(72,43): error TS4081: Exported type alias 'T62' has or is using private name 'U'.
513

614

7-
==== tests/cases/conformance/types/conditional/inferTypes1.ts (3 errors) ====
15+
==== tests/cases/conformance/types/conditional/inferTypes1.ts (11 errors) ====
816
type Unpacked<T> =
917
T extends (infer U)[] ? U :
1018
T extends (...args: any[]) => infer U ? U :
@@ -80,4 +88,24 @@ tests/cases/conformance/types/conditional/inferTypes1.ts(44,25): error TS2344: T
8088
type T52 = X3<{ a: (x: string) => void, b: (x: string) => void }>; // string
8189
type T53 = X3<{ a: (x: number) => void, b: (x: string) => void }>; // string & number
8290
type T54 = X3<{ a: (x: number) => void, b: () => void }>; // number
91+
92+
type T60 = infer U; // Error
93+
~~~~~~~
94+
!!! error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
95+
type T61<T> = infer A extends infer B ? infer C : infer D; // Error
96+
~~~~~~~
97+
!!! error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
98+
~~~~~~~
99+
!!! error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
100+
~~~~~~~
101+
!!! error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
102+
type T62<T> = U extends (infer U)[] ? U : U; // Error
103+
~
104+
!!! error TS2304: Cannot find name 'U'.
105+
~
106+
!!! error TS4081: Exported type alias 'T62' has or is using private name 'U'.
107+
~
108+
!!! error TS2304: Cannot find name 'U'.
109+
~
110+
!!! error TS4081: Exported type alias 'T62' has or is using private name 'U'.
83111

tests/baselines/reference/inferTypes1.js

Lines changed: 4 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ type T51 = X3<{ a: (x: string) => void }>; // never
6767
type T52 = X3<{ a: (x: string) => void, b: (x: string) => void }>; // string
6868
type T53 = X3<{ a: (x: number) => void, b: (x: string) => void }>; // string & number
6969
type T54 = X3<{ a: (x: number) => void, b: () => void }>; // number
70+
71+
type T60 = infer U; // Error
72+
type T61<T> = infer A extends infer B ? infer C : infer D; // Error
73+
type T62<T> = U extends (infer U)[] ? U : U; // Error
7074

7175

7276
//// [inferTypes1.js]
@@ -81,103 +85,3 @@ var C = /** @class */ (function () {
8185
}
8286
return C;
8387
}());
84-
85-
86-
//// [inferTypes1.d.ts]
87-
declare type Unpacked<T> = T extends (infer U)[] ? U : T extends (...args: any[]) => infer U ? U : T extends Promise<infer U> ? U : T;
88-
declare type T00 = Unpacked<string>;
89-
declare type T01 = Unpacked<string[]>;
90-
declare type T02 = Unpacked<() => string>;
91-
declare type T03 = Unpacked<Promise<string>>;
92-
declare type T04 = Unpacked<Unpacked<Promise<string>[]>>;
93-
declare type T05 = Unpacked<any>;
94-
declare type T06 = Unpacked<never>;
95-
declare type ReturnType<T extends Function> = T extends ((...args: any[]) => infer R) | (new (...args: any[]) => infer R) ? R : any;
96-
declare function f1(s: string): {
97-
a: number;
98-
b: string;
99-
};
100-
declare class C {
101-
x: number;
102-
y: number;
103-
}
104-
declare type T10 = ReturnType<() => string>;
105-
declare type T11 = ReturnType<(s: string) => void>;
106-
declare type T12 = ReturnType<(<T>() => T)>;
107-
declare type T13 = ReturnType<(<T extends U, U extends number[]>() => T)>;
108-
declare type T14 = ReturnType<typeof f1>;
109-
declare type T15 = ReturnType<typeof C>;
110-
declare type T16 = ReturnType<any>;
111-
declare type T17 = ReturnType<never>;
112-
declare type T18 = ReturnType<string>;
113-
declare type T19 = ReturnType<Function>;
114-
declare type ArgumentType<T extends (x: any) => any> = T extends (a: infer A) => any ? A : any;
115-
declare type T20 = ArgumentType<() => void>;
116-
declare type T21 = ArgumentType<(x: string) => number>;
117-
declare type T22 = ArgumentType<(x?: string) => number>;
118-
declare type T23 = ArgumentType<(...args: string[]) => number>;
119-
declare type T24 = ArgumentType<(x: string, y: string) => number>;
120-
declare type T25 = ArgumentType<Function>;
121-
declare type T26 = ArgumentType<any>;
122-
declare type T27 = ArgumentType<never>;
123-
declare type X1<T extends {
124-
x: any;
125-
y: any;
126-
}> = T extends {
127-
x: infer X;
128-
y: infer Y;
129-
} ? [X, Y] : any;
130-
declare type T30 = X1<{
131-
x: any;
132-
y: any;
133-
}>;
134-
declare type T31 = X1<{
135-
x: number;
136-
y: string;
137-
}>;
138-
declare type T32 = X1<{
139-
x: number;
140-
y: string;
141-
z: boolean;
142-
}>;
143-
declare type X2<T> = T extends {
144-
a: infer U;
145-
b: infer U;
146-
} ? U : never;
147-
declare type T40 = X2<{}>;
148-
declare type T41 = X2<{
149-
a: string;
150-
}>;
151-
declare type T42 = X2<{
152-
a: string;
153-
b: string;
154-
}>;
155-
declare type T43 = X2<{
156-
a: number;
157-
b: string;
158-
}>;
159-
declare type T44 = X2<{
160-
a: number;
161-
b: string;
162-
c: boolean;
163-
}>;
164-
declare type X3<T> = T extends {
165-
a: (x: infer U) => void;
166-
b: (x: infer U) => void;
167-
} ? U : never;
168-
declare type T50 = X3<{}>;
169-
declare type T51 = X3<{
170-
a: (x: string) => void;
171-
}>;
172-
declare type T52 = X3<{
173-
a: (x: string) => void;
174-
b: (x: string) => void;
175-
}>;
176-
declare type T53 = X3<{
177-
a: (x: number) => void;
178-
b: (x: string) => void;
179-
}>;
180-
declare type T54 = X3<{
181-
a: (x: number) => void;
182-
b: () => void;
183-
}>;

tests/baselines/reference/inferTypes1.symbols

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,3 +297,21 @@ type T54 = X3<{ a: (x: number) => void, b: () => void }>; // number
297297
>x : Symbol(x, Decl(inferTypes1.ts, 67, 20))
298298
>b : Symbol(b, Decl(inferTypes1.ts, 67, 39))
299299

300+
type T60 = infer U; // Error
301+
>T60 : Symbol(T60, Decl(inferTypes1.ts, 67, 57))
302+
>U : Symbol(U, Decl(inferTypes1.ts, 69, 16))
303+
304+
type T61<T> = infer A extends infer B ? infer C : infer D; // Error
305+
>T61 : Symbol(T61, Decl(inferTypes1.ts, 69, 19))
306+
>T : Symbol(T, Decl(inferTypes1.ts, 70, 9))
307+
>A : Symbol(A, Decl(inferTypes1.ts, 70, 19))
308+
>B : Symbol(B, Decl(inferTypes1.ts, 70, 35))
309+
>C : Symbol(C, Decl(inferTypes1.ts, 70, 45))
310+
>D : Symbol(D, Decl(inferTypes1.ts, 70, 55))
311+
312+
type T62<T> = U extends (infer U)[] ? U : U; // Error
313+
>T62 : Symbol(T62, Decl(inferTypes1.ts, 70, 58))
314+
>T : Symbol(T, Decl(inferTypes1.ts, 71, 9))
315+
>U : Symbol(U, Decl(inferTypes1.ts, 71, 30))
316+
>U : Symbol(U, Decl(inferTypes1.ts, 71, 30))
317+

tests/baselines/reference/inferTypes1.types

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,3 +301,23 @@ type T54 = X3<{ a: (x: number) => void, b: () => void }>; // number
301301
>x : number
302302
>b : () => void
303303

304+
type T60 = infer U; // Error
305+
>T60 : U
306+
>U : U
307+
308+
type T61<T> = infer A extends infer B ? infer C : infer D; // Error
309+
>T61 : never
310+
>T : T
311+
>A : A
312+
>B : B
313+
>C : C
314+
>D : D
315+
316+
type T62<T> = U extends (infer U)[] ? U : U; // Error
317+
>T62 : any
318+
>T : T
319+
>U : No type information available!
320+
>U : U
321+
>U : U
322+
>U : No type information available!
323+

0 commit comments

Comments
 (0)