File: propertiesAndIndexers2.errors.txt

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (46 lines) | stat: -rw-r--r-- 2,850 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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
tests/cases/compiler/propertiesAndIndexers2.ts(2,5): error TS2413: Numeric index type 'string' is not assignable to string index type 'number'.
tests/cases/compiler/propertiesAndIndexers2.ts(8,5): error TS2411: Property 'c' of type 'string' is not assignable to string index type 'number'.
tests/cases/compiler/propertiesAndIndexers2.ts(9,5): error TS2411: Property '3' of type 'string' is not assignable to string index type 'number'.
tests/cases/compiler/propertiesAndIndexers2.ts(10,5): error TS2411: Property 'Infinity' of type 'string' is not assignable to string index type 'number'.
tests/cases/compiler/propertiesAndIndexers2.ts(11,5): error TS2411: Property '"-Infinity"' of type 'string' is not assignable to string index type 'number'.
tests/cases/compiler/propertiesAndIndexers2.ts(12,5): error TS2411: Property 'NaN' of type 'string' is not assignable to string index type 'number'.
tests/cases/compiler/propertiesAndIndexers2.ts(13,5): error TS2411: Property '"-NaN"' of type 'string' is not assignable to string index type 'number'.
tests/cases/compiler/propertiesAndIndexers2.ts(14,5): error TS2411: Property '6' of type '() => string' is not assignable to string index type 'number'.
tests/cases/compiler/propertiesAndIndexers2.ts(14,5): error TS2412: Property '6' of type '() => string' is not assignable to numeric index type 'string'.


==== tests/cases/compiler/propertiesAndIndexers2.ts (9 errors) ====
    interface A {
        [n: number]: string;
        ~~~~~~~~~~~~~~~~~~~~
!!! error TS2413: Numeric index type 'string' is not assignable to string index type 'number'.
        [s: string]: number;
    }
    
    // All of these should fail.
    interface B extends A {
        c: string;
        ~
!!! error TS2411: Property 'c' of type 'string' is not assignable to string index type 'number'.
        3: string;
        ~
!!! error TS2411: Property '3' of type 'string' is not assignable to string index type 'number'.
        Infinity: string;
        ~~~~~~~~
!!! error TS2411: Property 'Infinity' of type 'string' is not assignable to string index type 'number'.
        "-Infinity": string;
        ~~~~~~~~~~~
!!! error TS2411: Property '"-Infinity"' of type 'string' is not assignable to string index type 'number'.
        NaN: string;
        ~~~
!!! error TS2411: Property 'NaN' of type 'string' is not assignable to string index type 'number'.
        "-NaN": string;
        ~~~~~~
!!! error TS2411: Property '"-NaN"' of type 'string' is not assignable to string index type 'number'.
        6(): string;
        ~~~~~~~~~~~~
!!! error TS2411: Property '6' of type '() => string' is not assignable to string index type 'number'.
        ~~~~~~~~~~~~
!!! error TS2412: Property '6' of type '() => string' is not assignable to numeric index type 'string'.
    }