Accept new baselines

This commit is contained in:
Anders Hejlsberg
2018-01-31 07:48:54 -08:00
parent afec056bab
commit 36a49adac4
4 changed files with 71 additions and 101 deletions
@@ -2,9 +2,17 @@ tests/cases/conformance/types/conditional/inferTypes1.ts(34,23): error TS2344: T
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'.
tests/cases/conformance/types/conditional/inferTypes1.ts(44,25): error TS2344: Type 'Function' does not satisfy the constraint '(x: any) => any'.
Type 'Function' provides no match for the signature '(x: any): any'.
tests/cases/conformance/types/conditional/inferTypes1.ts(70,12): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
tests/cases/conformance/types/conditional/inferTypes1.ts(71,15): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
tests/cases/conformance/types/conditional/inferTypes1.ts(71,41): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
tests/cases/conformance/types/conditional/inferTypes1.ts(71,51): error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
tests/cases/conformance/types/conditional/inferTypes1.ts(72,15): error TS2304: Cannot find name 'U'.
tests/cases/conformance/types/conditional/inferTypes1.ts(72,15): error TS4081: Exported type alias 'T62' has or is using private name 'U'.
tests/cases/conformance/types/conditional/inferTypes1.ts(72,43): error TS2304: Cannot find name 'U'.
tests/cases/conformance/types/conditional/inferTypes1.ts(72,43): error TS4081: Exported type alias 'T62' has or is using private name 'U'.
==== tests/cases/conformance/types/conditional/inferTypes1.ts (3 errors) ====
==== tests/cases/conformance/types/conditional/inferTypes1.ts (11 errors) ====
type Unpacked<T> =
T extends (infer U)[] ? U :
T extends (...args: any[]) => infer U ? U :
@@ -80,4 +88,24 @@ tests/cases/conformance/types/conditional/inferTypes1.ts(44,25): error TS2344: T
type T52 = X3<{ a: (x: string) => void, b: (x: string) => void }>; // string
type T53 = X3<{ a: (x: number) => void, b: (x: string) => void }>; // string & number
type T54 = X3<{ a: (x: number) => void, b: () => void }>; // number
type T60 = infer U; // Error
~~~~~~~
!!! error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
type T61<T> = infer A extends infer B ? infer C : infer D; // Error
~~~~~~~
!!! error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
~~~~~~~
!!! error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
~~~~~~~
!!! error TS1338: 'infer' declarations are only permitted in the 'extends' clause of a conditional type.
type T62<T> = U extends (infer U)[] ? U : U; // Error
~
!!! error TS2304: Cannot find name 'U'.
~
!!! error TS4081: Exported type alias 'T62' has or is using private name 'U'.
~
!!! error TS2304: Cannot find name 'U'.
~
!!! error TS4081: Exported type alias 'T62' has or is using private name 'U'.
+4 -100
View File
@@ -67,6 +67,10 @@ type T51 = X3<{ a: (x: string) => void }>; // never
type T52 = X3<{ a: (x: string) => void, b: (x: string) => void }>; // string
type T53 = X3<{ a: (x: number) => void, b: (x: string) => void }>; // string & number
type T54 = X3<{ a: (x: number) => void, b: () => void }>; // number
type T60 = infer U; // Error
type T61<T> = infer A extends infer B ? infer C : infer D; // Error
type T62<T> = U extends (infer U)[] ? U : U; // Error
//// [inferTypes1.js]
@@ -81,103 +85,3 @@ var C = /** @class */ (function () {
}
return C;
}());
//// [inferTypes1.d.ts]
declare type Unpacked<T> = T extends (infer U)[] ? U : T extends (...args: any[]) => infer U ? U : T extends Promise<infer U> ? U : T;
declare type T00 = Unpacked<string>;
declare type T01 = Unpacked<string[]>;
declare type T02 = Unpacked<() => string>;
declare type T03 = Unpacked<Promise<string>>;
declare type T04 = Unpacked<Unpacked<Promise<string>[]>>;
declare type T05 = Unpacked<any>;
declare type T06 = Unpacked<never>;
declare type ReturnType<T extends Function> = T extends ((...args: any[]) => infer R) | (new (...args: any[]) => infer R) ? R : any;
declare function f1(s: string): {
a: number;
b: string;
};
declare class C {
x: number;
y: number;
}
declare type T10 = ReturnType<() => string>;
declare type T11 = ReturnType<(s: string) => void>;
declare type T12 = ReturnType<(<T>() => T)>;
declare type T13 = ReturnType<(<T extends U, U extends number[]>() => T)>;
declare type T14 = ReturnType<typeof f1>;
declare type T15 = ReturnType<typeof C>;
declare type T16 = ReturnType<any>;
declare type T17 = ReturnType<never>;
declare type T18 = ReturnType<string>;
declare type T19 = ReturnType<Function>;
declare type ArgumentType<T extends (x: any) => any> = T extends (a: infer A) => any ? A : any;
declare type T20 = ArgumentType<() => void>;
declare type T21 = ArgumentType<(x: string) => number>;
declare type T22 = ArgumentType<(x?: string) => number>;
declare type T23 = ArgumentType<(...args: string[]) => number>;
declare type T24 = ArgumentType<(x: string, y: string) => number>;
declare type T25 = ArgumentType<Function>;
declare type T26 = ArgumentType<any>;
declare type T27 = ArgumentType<never>;
declare type X1<T extends {
x: any;
y: any;
}> = T extends {
x: infer X;
y: infer Y;
} ? [X, Y] : any;
declare type T30 = X1<{
x: any;
y: any;
}>;
declare type T31 = X1<{
x: number;
y: string;
}>;
declare type T32 = X1<{
x: number;
y: string;
z: boolean;
}>;
declare type X2<T> = T extends {
a: infer U;
b: infer U;
} ? U : never;
declare type T40 = X2<{}>;
declare type T41 = X2<{
a: string;
}>;
declare type T42 = X2<{
a: string;
b: string;
}>;
declare type T43 = X2<{
a: number;
b: string;
}>;
declare type T44 = X2<{
a: number;
b: string;
c: boolean;
}>;
declare type X3<T> = T extends {
a: (x: infer U) => void;
b: (x: infer U) => void;
} ? U : never;
declare type T50 = X3<{}>;
declare type T51 = X3<{
a: (x: string) => void;
}>;
declare type T52 = X3<{
a: (x: string) => void;
b: (x: string) => void;
}>;
declare type T53 = X3<{
a: (x: number) => void;
b: (x: string) => void;
}>;
declare type T54 = X3<{
a: (x: number) => void;
b: () => void;
}>;
@@ -297,3 +297,21 @@ type T54 = X3<{ a: (x: number) => void, b: () => void }>; // number
>x : Symbol(x, Decl(inferTypes1.ts, 67, 20))
>b : Symbol(b, Decl(inferTypes1.ts, 67, 39))
type T60 = infer U; // Error
>T60 : Symbol(T60, Decl(inferTypes1.ts, 67, 57))
>U : Symbol(U, Decl(inferTypes1.ts, 69, 16))
type T61<T> = infer A extends infer B ? infer C : infer D; // Error
>T61 : Symbol(T61, Decl(inferTypes1.ts, 69, 19))
>T : Symbol(T, Decl(inferTypes1.ts, 70, 9))
>A : Symbol(A, Decl(inferTypes1.ts, 70, 19))
>B : Symbol(B, Decl(inferTypes1.ts, 70, 35))
>C : Symbol(C, Decl(inferTypes1.ts, 70, 45))
>D : Symbol(D, Decl(inferTypes1.ts, 70, 55))
type T62<T> = U extends (infer U)[] ? U : U; // Error
>T62 : Symbol(T62, Decl(inferTypes1.ts, 70, 58))
>T : Symbol(T, Decl(inferTypes1.ts, 71, 9))
>U : Symbol(U, Decl(inferTypes1.ts, 71, 30))
>U : Symbol(U, Decl(inferTypes1.ts, 71, 30))
@@ -301,3 +301,23 @@ type T54 = X3<{ a: (x: number) => void, b: () => void }>; // number
>x : number
>b : () => void
type T60 = infer U; // Error
>T60 : U
>U : U
type T61<T> = infer A extends infer B ? infer C : infer D; // Error
>T61 : never
>T : T
>A : A
>B : B
>C : C
>D : D
type T62<T> = U extends (infer U)[] ? U : U; // Error
>T62 : any
>T : T
>U : No type information available!
>U : U
>U : U
>U : No type information available!