Skip to content

Commit 57ef618

Browse files
committed
Add regression test
1 parent e71afc3 commit 57ef618

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -567,3 +567,12 @@ function f3<T, K extends Extract<keyof T, string>>(t: T, k: K, tk: T[K]): void {
567567
type Predicates<TaggedRecord> = {
568568
[T in keyof TaggedRecord]: (variant: TaggedRecord[keyof TaggedRecord]) => variant is TaggedRecord[T]
569569
}
570+
571+
// Repros from #23592
572+
573+
type Example<T extends { [K in keyof T]: { prop: any } }> = { [K in keyof T]: T[K]["prop"] };
574+
type Result = Example<{ a: { prop: string }; b: { prop: number } }>;
575+
576+
type Helper2<T> = { [K in keyof T]: Extract<T[K], { prop: any }> };
577+
type Example2<T> = { [K in keyof Helper2<T>]: Helper2<T>[K]["prop"] };
578+
type Result2 = Example2<{ 1: { prop: string }; 2: { prop: number } }>;

0 commit comments

Comments
 (0)