mirror of
https://github.com/microsoft/TypeScript.git
synced 2025-11-18 17:21:48 +00:00
Accept new baselines
This commit is contained in:
1 parent
16f571b026
commit
56710dd537
4 files changed
+550
-366
No files matched your search
@@ -64,8 +64,8 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(159,5): error TS2
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(160,5): error TS2322: Type 'T' is not assignable to type 'ZeroOf<T>'.
|
||||
Type 'string | number' is not assignable to type 'ZeroOf<T>'.
|
||||
Type 'string' is not assignable to type 'ZeroOf<T>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(250,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'T1', but here has type 'Foo<T & U>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(275,43): error TS2322: Type 'T95<U>' is not assignable to type 'T94<U>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(254,9): error TS2403: Subsequent variable declarations must have the same type. Variable 'z' must be of type 'T1', but here has type 'Foo<T & U>'.
|
||||
tests/cases/conformance/types/conditional/conditionalTypes1.ts(279,43): error TS2322: Type 'T95<U>' is not assignable to type 'T94<U>'.
|
||||
Type 'boolean' is not assignable to type 'true'.
|
||||
|
||||
|
||||
@@ -318,6 +318,10 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(275,43): error TS
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'ZeroOf<T>'.
|
||||
}
|
||||
|
||||
type T35<T extends { a: string, b: number }> = T[];
|
||||
type T36<T> = T extends { a: string } ? T extends { b: number } ? T35<T> : never : never;
|
||||
type T37<T> = T extends { b: number } ? T extends { a: string } ? T35<T> : never : never;
|
||||
|
||||
type Extends<T, U> = T extends U ? true : false;
|
||||
type If<C extends boolean, T, F> = C extends true ? T : F;
|
||||
type Not<C extends boolean> = If<C, false, true>;
|
||||
@@ -477,4 +481,15 @@ tests/cases/conformance/types/conditional/conditionalTypes1.ts(275,43): error TS
|
||||
|
||||
type Test1 = NonFooKeys1<{foo: 1, bar: 2, baz: 3}>; // "bar" | "baz"
|
||||
type Test2 = NonFooKeys2<{foo: 1, bar: 2, baz: 3}>; // "bar" | "baz"
|
||||
|
||||
// Repro from #21729
|
||||
|
||||
interface Foo2 { foo: string; }
|
||||
interface Bar2 { bar: string; }
|
||||
type FooBar = Foo2 | Bar2;
|
||||
declare interface ExtractFooBar<FB extends FooBar> { }
|
||||
|
||||
type Extracted<Struct> = {
|
||||
[K in keyof Struct]: Struct[K] extends FooBar ? ExtractFooBar<Struct[K]> : Struct[K];
|
||||
}
|
||||
|
||||
@@ -161,6 +161,10 @@ function f21<T extends number | string>(x: T, y: ZeroOf<T>) {
|
||||
y = x; // Error
|
||||
}
|
||||
|
||||
type T35<T extends { a: string, b: number }> = T[];
|
||||
type T36<T> = T extends { a: string } ? T extends { b: number } ? T35<T> : never : never;
|
||||
type T37<T> = T extends { b: number } ? T extends { a: string } ? T35<T> : never : never;
|
||||
|
||||
type Extends<T, U> = T extends U ? true : false;
|
||||
type If<C extends boolean, T, F> = C extends true ? T : F;
|
||||
type Not<C extends boolean> = If<C, false, true>;
|
||||
@@ -315,6 +319,17 @@ type NonFooKeys2<T extends object> = Exclude<keyof T, 'foo'>;
|
||||
|
||||
type Test1 = NonFooKeys1<{foo: 1, bar: 2, baz: 3}>; // "bar" | "baz"
|
||||
type Test2 = NonFooKeys2<{foo: 1, bar: 2, baz: 3}>; // "bar" | "baz"
|
||||
|
||||
// Repro from #21729
|
||||
|
||||
interface Foo2 { foo: string; }
|
||||
interface Bar2 { bar: string; }
|
||||
type FooBar = Foo2 | Bar2;
|
||||
declare interface ExtractFooBar<FB extends FooBar> { }
|
||||
|
||||
type Extracted<Struct> = {
|
||||
[K in keyof Struct]: Struct[K] extends FooBar ? ExtractFooBar<Struct[K]> : Struct[K];
|
||||
}
|
||||
|
||||
|
||||
//// [conditionalTypes1.js]
|
||||
@@ -517,6 +532,20 @@ declare type ZeroOf<T extends number | string | boolean> = T extends number ? 0
|
||||
declare function zeroOf<T extends number | string | boolean>(value: T): ZeroOf<T>;
|
||||
declare function f20<T extends string>(n: number, b: boolean, x: number | boolean, y: T): void;
|
||||
declare function f21<T extends number | string>(x: T, y: ZeroOf<T>): void;
|
||||
declare type T35<T extends {
|
||||
a: string;
|
||||
b: number;
|
||||
}> = T[];
|
||||
declare type T36<T> = T extends {
|
||||
a: string;
|
||||
} ? T extends {
|
||||
b: number;
|
||||
} ? T35<T> : never : never;
|
||||
declare type T37<T> = T extends {
|
||||
b: number;
|
||||
} ? T extends {
|
||||
a: string;
|
||||
} ? T35<T> : never : never;
|
||||
declare type Extends<T, U> = T extends U ? true : false;
|
||||
declare type If<C extends boolean, T, F> = C extends true ? T : F;
|
||||
declare type Not<C extends boolean> = If<C, false, true>;
|
||||
@@ -624,3 +653,15 @@ declare type Test2 = NonFooKeys2<{
|
||||
bar: 2;
|
||||
baz: 3;
|
||||
}>;
|
||||
interface Foo2 {
|
||||
foo: string;
|
||||
}
|
||||
interface Bar2 {
|
||||
bar: string;
|
||||
}
|
||||
declare type FooBar = Foo2 | Bar2;
|
||||
declare interface ExtractFooBar<FB extends FooBar> {
|
||||
}
|
||||
declare type Extracted<Struct> = {
|
||||
[K in keyof Struct]: Struct[K] extends FooBar ? ExtractFooBar<Struct[K]> : Struct[K];
|
||||
};
|
||||
File diff suppressed because it is too large.
Load diff
@@ -678,6 +678,33 @@ function f21<T extends number | string>(x: T, y: ZeroOf<T>) {
|
||||
>x : T
|
||||
}
|
||||
|
||||
type T35<T extends { a: string, b: number }> = T[];
|
||||
>T35 : T[]
|
||||
>T : T
|
||||
>a : string
|
||||
>b : number
|
||||
>T : T
|
||||
|
||||
type T36<T> = T extends { a: string } ? T extends { b: number } ? T35<T> : never : never;
|
||||
>T36 : T36<T>
|
||||
>T : T
|
||||
>T : T
|
||||
>a : string
|
||||
>T : T
|
||||
>b : number
|
||||
>T35 : T[]
|
||||
>T : T
|
||||
|
||||
type T37<T> = T extends { b: number } ? T extends { a: string } ? T35<T> : never : never;
|
||||
>T37 : T37<T>
|
||||
>T : T
|
||||
>T : T
|
||||
>b : number
|
||||
>T : T
|
||||
>a : string
|
||||
>T35 : T[]
|
||||
>T : T
|
||||
|
||||
type Extends<T, U> = T extends U ? true : false;
|
||||
>Extends : Extends<T, U>
|
||||
>T : T
|
||||
@@ -1370,3 +1397,40 @@ type Test2 = NonFooKeys2<{foo: 1, bar: 2, baz: 3}>; // "bar" | "baz"
|
||||
>bar : 2
|
||||
>baz : 3
|
||||
|
||||
// Repro from #21729
|
||||
|
||||
interface Foo2 { foo: string; }
|
||||
>Foo2 : Foo2
|
||||
>foo : string
|
||||
|
||||
interface Bar2 { bar: string; }
|
||||
>Bar2 : Bar2
|
||||
>bar : string
|
||||
|
||||
type FooBar = Foo2 | Bar2;
|
||||
>FooBar : FooBar
|
||||
>Foo2 : Foo2
|
||||
>Bar2 : Bar2
|
||||
|
||||
declare interface ExtractFooBar<FB extends FooBar> { }
|
||||
>ExtractFooBar : ExtractFooBar<FB>
|
||||
>FB : FB
|
||||
>FooBar : FooBar
|
||||
|
||||
type Extracted<Struct> = {
|
||||
>Extracted : Extracted<Struct>
|
||||
>Struct : Struct
|
||||
|
||||
[K in keyof Struct]: Struct[K] extends FooBar ? ExtractFooBar<Struct[K]> : Struct[K];
|
||||
>K : K
|
||||
>Struct : Struct
|
||||
>Struct : Struct
|
||||
>K : K
|
||||
>FooBar : FooBar
|
||||
>ExtractFooBar : ExtractFooBar<FB>
|
||||
>Struct : Struct
|
||||
>K : K
|
||||
>Struct : Struct
|
||||
>K : K
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user