75 lines
1.2 KiB
Plaintext
75 lines
1.2 KiB
Plaintext
=== tests/cases/conformance/types/mapped/mappedTypeWithAny.ts ===
|
|
type Item = { value: string };
|
|
>Item : Item
|
|
>value : string
|
|
|
|
type ItemMap<T> = { [P in keyof T]: Item };
|
|
>ItemMap : ItemMap<T>
|
|
>T : T
|
|
>P : P
|
|
>T : T
|
|
>Item : Item
|
|
|
|
declare let x0: keyof any;
|
|
>x0 : string
|
|
|
|
declare let x1: { [P in any]: Item };
|
|
>x1 : { [x: string]: Item; }
|
|
>P : P
|
|
>Item : Item
|
|
|
|
declare let x2: { [P in string]: Item };
|
|
>x2 : { [x: string]: Item; }
|
|
>P : P
|
|
>Item : Item
|
|
|
|
declare let x3: { [P in keyof any]: Item };
|
|
>x3 : { [x: string]: Item; }
|
|
>P : P
|
|
>Item : Item
|
|
|
|
declare let x4: ItemMap<any>;
|
|
>x4 : ItemMap<any>
|
|
>ItemMap : ItemMap<T>
|
|
|
|
// Repro from #19152
|
|
|
|
type Data = {
|
|
>Data : Data
|
|
|
|
value: string;
|
|
>value : string
|
|
}
|
|
|
|
type StrictDataMap<T> = {
|
|
>StrictDataMap : StrictDataMap<T>
|
|
>T : T
|
|
|
|
[P in keyof T]: Data
|
|
>P : P
|
|
>T : T
|
|
>Data : Data
|
|
}
|
|
|
|
declare let z: StrictDataMap<any>;
|
|
>z : StrictDataMap<any>
|
|
>StrictDataMap : StrictDataMap<T>
|
|
|
|
for (let id in z) {
|
|
>id : string
|
|
>z : StrictDataMap<any>
|
|
|
|
let data = z[id];
|
|
>data : Data
|
|
>z[id] : Data
|
|
>z : StrictDataMap<any>
|
|
>id : string
|
|
|
|
let x = data.notAValue; // Error
|
|
>x : any
|
|
>data.notAValue : any
|
|
>data : Data
|
|
>notAValue : any
|
|
}
|
|
|