//// [mappedTypes4.ts] type Box = { }; type Boxified = { [P in keyof T]: Box; }; function boxify(obj: T): Boxified { if (typeof obj === "object") { let result = {} as Boxified; for (let k in obj) { result[k] = { value: obj[k] }; } return result; } return obj; } type A = { a: string }; type B = { b: string }; type C = { c: string }; function f1(x: A | B | C | undefined) { return boxify(x); } type T00 = Partial; type T01 = Readonly; type T02 = Boxified type T03 = Readonly; type T04 = Boxified; type T05 = Partial<"hello" | "world" | 42>; type BoxifiedWithSentinel = { [P in keyof T]: Box | U; } type T10 = BoxifiedWithSentinel; type T11 = BoxifiedWithSentinel; type T12 = BoxifiedWithSentinel; type DeepReadonly = { readonly [P in keyof T]: DeepReadonly; }; type Foo = { x: number; y: { a: string, b: number }; z: boolean; }; type DeepReadonlyFoo = { readonly x: number; readonly y: { readonly a: string, readonly b: number }; readonly z: boolean; }; var x1: DeepReadonly; var x1: DeepReadonlyFoo; // Repro from #13232 type Z = { a: number }; type Clone = { [P in keyof (T & {})]: T[P]; }; type M = Clone; // M should be { a: number } var z1: Z; var z1: Clone; //// [mappedTypes4.js] function boxify(obj) { if (typeof obj === "object") { var result = {}; for (var k in obj) { result[k] = { value: obj[k] }; } return result; } return obj; } function f1(x) { return boxify(x); } var x1; var x1; var z1; var z1; //// [mappedTypes4.d.ts] declare type Box = {}; declare type Boxified = { [P in keyof T]: Box; }; declare function boxify(obj: T): Boxified; declare type A = { a: string; }; declare type B = { b: string; }; declare type C = { c: string; }; declare function f1(x: A | B | C | undefined): Boxified; declare type T00 = Partial; declare type T01 = Readonly; declare type T02 = Boxified; declare type T03 = Readonly; declare type T04 = Boxified; declare type T05 = Partial<"hello" | "world" | 42>; declare type BoxifiedWithSentinel = { [P in keyof T]: Box | U; }; declare type T10 = BoxifiedWithSentinel; declare type T11 = BoxifiedWithSentinel; declare type T12 = BoxifiedWithSentinel; declare type DeepReadonly = { readonly [P in keyof T]: DeepReadonly; }; declare type Foo = { x: number; y: { a: string; b: number; }; z: boolean; }; declare type DeepReadonlyFoo = { readonly x: number; readonly y: { readonly a: string; readonly b: number; }; readonly z: boolean; }; declare var x1: DeepReadonly; declare var x1: DeepReadonlyFoo; declare type Z = { a: number; }; declare type Clone = { [P in keyof (T & {})]: T[P]; }; declare type M = Clone; declare var z1: Z; declare var z1: Clone;