Skip to content

Commit 6569f45

Browse files
committed
Accept new baselines
1 parent 081a394 commit 6569f45

File tree

4 files changed

+118
-0
lines changed

4 files changed

+118
-0
lines changed

tests/baselines/reference/inferTypes1.errors.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,4 +191,19 @@ tests/cases/conformance/types/conditional/inferTypes1.ts(134,40): error TS2322:
191191
type B<T> = string extends T ? { [P in T]: void; } : T; // Error
192192
~
193193
!!! error TS2322: Type 'T' is not assignable to type 'string'.
194+
195+
// Repro from #22302
196+
197+
type MatchingKeys<T, U, K extends keyof T = keyof T> =
198+
K extends keyof T ? T[K] extends U ? K : never : never;
199+
200+
type VoidKeys<T> = MatchingKeys<T, void>;
201+
202+
interface test {
203+
a: 1,
204+
b: void
205+
}
206+
207+
type T80 = MatchingKeys<test, void>;
208+
type T81 = VoidKeys<test>;
194209

tests/baselines/reference/inferTypes1.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,21 @@ type C2<S, U extends void> = S extends A2<infer T, U> ? [T, U] : never;
133133

134134
type A<T> = T extends string ? { [P in T]: void; } : T;
135135
type B<T> = string extends T ? { [P in T]: void; } : T; // Error
136+
137+
// Repro from #22302
138+
139+
type MatchingKeys<T, U, K extends keyof T = keyof T> =
140+
K extends keyof T ? T[K] extends U ? K : never : never;
141+
142+
type VoidKeys<T> = MatchingKeys<T, void>;
143+
144+
interface test {
145+
a: 1,
146+
b: void
147+
}
148+
149+
type T80 = MatchingKeys<test, void>;
150+
type T81 = VoidKeys<test>;
136151

137152

138153
//// [inferTypes1.js]

tests/baselines/reference/inferTypes1.symbols

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -575,3 +575,47 @@ type B<T> = string extends T ? { [P in T]: void; } : T; // Error
575575
>T : Symbol(T, Decl(inferTypes1.ts, 133, 7))
576576
>T : Symbol(T, Decl(inferTypes1.ts, 133, 7))
577577

578+
// Repro from #22302
579+
580+
type MatchingKeys<T, U, K extends keyof T = keyof T> =
581+
>MatchingKeys : Symbol(MatchingKeys, Decl(inferTypes1.ts, 133, 55))
582+
>T : Symbol(T, Decl(inferTypes1.ts, 137, 18))
583+
>U : Symbol(U, Decl(inferTypes1.ts, 137, 20))
584+
>K : Symbol(K, Decl(inferTypes1.ts, 137, 23))
585+
>T : Symbol(T, Decl(inferTypes1.ts, 137, 18))
586+
>T : Symbol(T, Decl(inferTypes1.ts, 137, 18))
587+
588+
K extends keyof T ? T[K] extends U ? K : never : never;
589+
>K : Symbol(K, Decl(inferTypes1.ts, 137, 23))
590+
>T : Symbol(T, Decl(inferTypes1.ts, 137, 18))
591+
>T : Symbol(T, Decl(inferTypes1.ts, 137, 18))
592+
>K : Symbol(K, Decl(inferTypes1.ts, 137, 23))
593+
>U : Symbol(U, Decl(inferTypes1.ts, 137, 20))
594+
>K : Symbol(K, Decl(inferTypes1.ts, 137, 23))
595+
596+
type VoidKeys<T> = MatchingKeys<T, void>;
597+
>VoidKeys : Symbol(VoidKeys, Decl(inferTypes1.ts, 138, 59))
598+
>T : Symbol(T, Decl(inferTypes1.ts, 140, 14))
599+
>MatchingKeys : Symbol(MatchingKeys, Decl(inferTypes1.ts, 133, 55))
600+
>T : Symbol(T, Decl(inferTypes1.ts, 140, 14))
601+
602+
interface test {
603+
>test : Symbol(test, Decl(inferTypes1.ts, 140, 41))
604+
605+
a: 1,
606+
>a : Symbol(test.a, Decl(inferTypes1.ts, 142, 16))
607+
608+
b: void
609+
>b : Symbol(test.b, Decl(inferTypes1.ts, 143, 9))
610+
}
611+
612+
type T80 = MatchingKeys<test, void>;
613+
>T80 : Symbol(T80, Decl(inferTypes1.ts, 145, 1))
614+
>MatchingKeys : Symbol(MatchingKeys, Decl(inferTypes1.ts, 133, 55))
615+
>test : Symbol(test, Decl(inferTypes1.ts, 140, 41))
616+
617+
type T81 = VoidKeys<test>;
618+
>T81 : Symbol(T81, Decl(inferTypes1.ts, 147, 36))
619+
>VoidKeys : Symbol(VoidKeys, Decl(inferTypes1.ts, 138, 59))
620+
>test : Symbol(test, Decl(inferTypes1.ts, 140, 41))
621+

tests/baselines/reference/inferTypes1.types

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -582,3 +582,47 @@ type B<T> = string extends T ? { [P in T]: void; } : T; // Error
582582
>T : T
583583
>T : T
584584

585+
// Repro from #22302
586+
587+
type MatchingKeys<T, U, K extends keyof T = keyof T> =
588+
>MatchingKeys : MatchingKeys<T, U, K>
589+
>T : T
590+
>U : U
591+
>K : K
592+
>T : T
593+
>T : T
594+
595+
K extends keyof T ? T[K] extends U ? K : never : never;
596+
>K : K
597+
>T : T
598+
>T : T
599+
>K : K
600+
>U : U
601+
>K : K
602+
603+
type VoidKeys<T> = MatchingKeys<T, void>;
604+
>VoidKeys : MatchingKeys<T, void, keyof T>
605+
>T : T
606+
>MatchingKeys : MatchingKeys<T, U, K>
607+
>T : T
608+
609+
interface test {
610+
>test : test
611+
612+
a: 1,
613+
>a : 1
614+
615+
b: void
616+
>b : void
617+
}
618+
619+
type T80 = MatchingKeys<test, void>;
620+
>T80 : "b"
621+
>MatchingKeys : MatchingKeys<T, U, K>
622+
>test : test
623+
624+
type T81 = VoidKeys<test>;
625+
>T81 : "b"
626+
>VoidKeys : MatchingKeys<T, void, keyof T>
627+
>test : test
628+

0 commit comments

Comments
 (0)