diff --git a/tests/cases/conformance/types/mapped/mappedTypeWithAny.ts b/tests/cases/conformance/types/mapped/mappedTypeWithAny.ts new file mode 100644 index 00000000000..f8b6f8a39b7 --- /dev/null +++ b/tests/cases/conformance/types/mapped/mappedTypeWithAny.ts @@ -0,0 +1,27 @@ +// @strict: true +// @declaration: true + +type Item = { value: string }; +type ItemMap = { [P in keyof T]: Item }; + +declare let x0: keyof any; +declare let x1: { [P in any]: Item }; +declare let x2: { [P in string]: Item }; +declare let x3: { [P in keyof any]: Item }; +declare let x4: ItemMap; + +// Repro from #19152 + +type Data = { + value: string; +} + +type StrictDataMap = { + [P in keyof T]: Data +} + +declare let z: StrictDataMap; +for (let id in z) { + let data = z[id]; + let x = data.notAValue; // Error +}