Skip to content

Commit 081a394

Browse files
committed
Add regression test
1 parent c1aa0bd commit 081a394

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

tests/cases/conformance/types/conditional/inferTypes1.ts

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

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

0 commit comments

Comments
 (0)