Accept new baselines

This commit is contained in:
Anders Hejlsberg
2018-03-03 18:08:42 -08:00
parent 081a394927
commit 6569f45812
4 changed files with 118 additions and 0 deletions

View File

@@ -191,4 +191,19 @@ tests/cases/conformance/types/conditional/inferTypes1.ts(134,40): error TS2322:
type B<T> = string extends T ? { [P in T]: void; } : T; // Error
~
!!! error TS2322: Type 'T' is not assignable to type 'string'.
// Repro from #22302
type MatchingKeys<T, U, K extends keyof T = keyof T> =
K extends keyof T ? T[K] extends U ? K : never : never;
type VoidKeys<T> = MatchingKeys<T, void>;
interface test {
a: 1,
b: void
}
type T80 = MatchingKeys<test, void>;
type T81 = VoidKeys<test>;

View File

@@ -133,6 +133,21 @@ type C2<S, U extends void> = S extends A2<infer T, U> ? [T, U] : never;
type A<T> = T extends string ? { [P in T]: void; } : T;
type B<T> = string extends T ? { [P in T]: void; } : T; // Error
// Repro from #22302
type MatchingKeys<T, U, K extends keyof T = keyof T> =
K extends keyof T ? T[K] extends U ? K : never : never;
type VoidKeys<T> = MatchingKeys<T, void>;
interface test {
a: 1,
b: void
}
type T80 = MatchingKeys<test, void>;
type T81 = VoidKeys<test>;
//// [inferTypes1.js]

View File

@@ -575,3 +575,47 @@ type B<T> = string extends T ? { [P in T]: void; } : T; // Error
>T : Symbol(T, Decl(inferTypes1.ts, 133, 7))
>T : Symbol(T, Decl(inferTypes1.ts, 133, 7))
// Repro from #22302
type MatchingKeys<T, U, K extends keyof T = keyof T> =
>MatchingKeys : Symbol(MatchingKeys, Decl(inferTypes1.ts, 133, 55))
>T : Symbol(T, Decl(inferTypes1.ts, 137, 18))
>U : Symbol(U, Decl(inferTypes1.ts, 137, 20))
>K : Symbol(K, Decl(inferTypes1.ts, 137, 23))
>T : Symbol(T, Decl(inferTypes1.ts, 137, 18))
>T : Symbol(T, Decl(inferTypes1.ts, 137, 18))
K extends keyof T ? T[K] extends U ? K : never : never;
>K : Symbol(K, Decl(inferTypes1.ts, 137, 23))
>T : Symbol(T, Decl(inferTypes1.ts, 137, 18))
>T : Symbol(T, Decl(inferTypes1.ts, 137, 18))
>K : Symbol(K, Decl(inferTypes1.ts, 137, 23))
>U : Symbol(U, Decl(inferTypes1.ts, 137, 20))
>K : Symbol(K, Decl(inferTypes1.ts, 137, 23))
type VoidKeys<T> = MatchingKeys<T, void>;
>VoidKeys : Symbol(VoidKeys, Decl(inferTypes1.ts, 138, 59))
>T : Symbol(T, Decl(inferTypes1.ts, 140, 14))
>MatchingKeys : Symbol(MatchingKeys, Decl(inferTypes1.ts, 133, 55))
>T : Symbol(T, Decl(inferTypes1.ts, 140, 14))
interface test {
>test : Symbol(test, Decl(inferTypes1.ts, 140, 41))
a: 1,
>a : Symbol(test.a, Decl(inferTypes1.ts, 142, 16))
b: void
>b : Symbol(test.b, Decl(inferTypes1.ts, 143, 9))
}
type T80 = MatchingKeys<test, void>;
>T80 : Symbol(T80, Decl(inferTypes1.ts, 145, 1))
>MatchingKeys : Symbol(MatchingKeys, Decl(inferTypes1.ts, 133, 55))
>test : Symbol(test, Decl(inferTypes1.ts, 140, 41))
type T81 = VoidKeys<test>;
>T81 : Symbol(T81, Decl(inferTypes1.ts, 147, 36))
>VoidKeys : Symbol(VoidKeys, Decl(inferTypes1.ts, 138, 59))
>test : Symbol(test, Decl(inferTypes1.ts, 140, 41))

View File

@@ -582,3 +582,47 @@ type B<T> = string extends T ? { [P in T]: void; } : T; // Error
>T : T
>T : T
// Repro from #22302
type MatchingKeys<T, U, K extends keyof T = keyof T> =
>MatchingKeys : MatchingKeys<T, U, K>
>T : T
>U : U
>K : K
>T : T
>T : T
K extends keyof T ? T[K] extends U ? K : never : never;
>K : K
>T : T
>T : T
>K : K
>U : U
>K : K
type VoidKeys<T> = MatchingKeys<T, void>;
>VoidKeys : MatchingKeys<T, void, keyof T>
>T : T
>MatchingKeys : MatchingKeys<T, U, K>
>T : T
interface test {
>test : test
a: 1,
>a : 1
b: void
>b : void
}
type T80 = MatchingKeys<test, void>;
>T80 : "b"
>MatchingKeys : MatchingKeys<T, U, K>
>test : test
type T81 = VoidKeys<test>;
>T81 : "b"
>VoidKeys : MatchingKeys<T, void, keyof T>
>test : test