Skip to content

Commit bd442b7

Browse files
committed
Add regression test
1 parent 1575b7a commit bd442b7

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,3 +341,15 @@ declare interface ExtractFooBar<FB extends FooBar> { }
341341
type Extracted<Struct> = {
342342
[K in keyof Struct]: Struct[K] extends FooBar ? ExtractFooBar<Struct[K]> : Struct[K];
343343
}
344+
345+
// Repro from #22985
346+
347+
type RecursivePartial<T> = {
348+
[P in keyof T]?: T[P] extends Array<any> ? {[index: number]: RecursivePartial<T[P][0]>} :
349+
T[P] extends object ? RecursivePartial<T[P]> : T[P];
350+
};
351+
352+
declare function assign<T>(o: T, a: RecursivePartial<T>): void;
353+
354+
var a = {o: 1, b: 2, c: [{a: 1, c: '213'}]}
355+
assign(a, {o: 2, c: {0: {a: 2, c: '213123'}}})

0 commit comments

Comments
 (0)