Add regression test

This commit is contained in:
Anders Hejlsberg 2018-03-29 10:22:11 -07:00 committed by Mohamed Hegazy
parent 052680d4ea
commit c4e21c912e

View File

@ -341,3 +341,15 @@ declare interface ExtractFooBar<FB extends FooBar> { }
type Extracted<Struct> = {
[K in keyof Struct]: Struct[K] extends FooBar ? ExtractFooBar<Struct[K]> : Struct[K];
}
// Repro from #22985
type RecursivePartial<T> = {
[P in keyof T]?: T[P] extends Array<any> ? {[index: number]: RecursivePartial<T[P][0]>} :
T[P] extends object ? RecursivePartial<T[P]> : T[P];
};
declare function assign<T>(o: T, a: RecursivePartial<T>): void;
var a = {o: 1, b: 2, c: [{a: 1, c: '213'}]}
assign(a, {o: 2, c: {0: {a: 2, c: '213123'}}})