Add tests
This commit is contained in:
parent
fa65bd2062
commit
ee0715a073
1 changed files with 27 additions and 0 deletions
27
tests/cases/conformance/types/mapped/mappedTypeWithAny.ts
Normal file
27
tests/cases/conformance/types/mapped/mappedTypeWithAny.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
// @strict: true
|
||||
// @declaration: true
|
||||
|
||||
type Item = { value: string };
|
||||
type ItemMap<T> = { [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<any>;
|
||||
|
||||
// Repro from #19152
|
||||
|
||||
type Data = {
|
||||
value: string;
|
||||
}
|
||||
|
||||
type StrictDataMap<T> = {
|
||||
[P in keyof T]: Data
|
||||
}
|
||||
|
||||
declare let z: StrictDataMap<any>;
|
||||
for (let id in z) {
|
||||
let data = z[id];
|
||||
let x = data.notAValue; // Error
|
||||
}
|
Loading…
Reference in a new issue