File: mappedTypeWithAny.errors.txt

package info (click to toggle)
node-typescript 4.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 396,552 kB
  • sloc: javascript: 1,444,377; makefile: 7; sh: 3
file content (31 lines) | stat: -rw-r--r-- 920 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
tests/cases/conformance/types/mapped/mappedTypeWithAny.ts(23,16): error TS2339: Property 'notAValue' does not exist on type 'Data'.


==== tests/cases/conformance/types/mapped/mappedTypeWithAny.ts (1 errors) ====
    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
                   ~~~~~~~~~
!!! error TS2339: Property 'notAValue' does not exist on type 'Data'.
    }