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 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111
|
tests/cases/compiler/propertiesAndIndexers.ts(16,5): error TS2411: Property '1' of type 'Z' is not assignable to 'number' index type 'string'.
tests/cases/compiler/propertiesAndIndexers.ts(18,5): error TS2411: Property '3' of type 'boolean' is not assignable to 'number' index type 'string'.
tests/cases/compiler/propertiesAndIndexers.ts(19,5): error TS2411: Property '6' of type '() => string' is not assignable to 'number' index type 'string'.
tests/cases/compiler/propertiesAndIndexers.ts(23,5): error TS2411: Property '4' of type 'boolean' is not assignable to 'number' index type 'string'.
tests/cases/compiler/propertiesAndIndexers.ts(28,5): error TS2411: Property '1' of type 'Z' is not assignable to 'string' index type 'number'.
tests/cases/compiler/propertiesAndIndexers.ts(28,5): error TS2411: Property 'a' of type 'Y' is not assignable to 'string' index type 'number'.
tests/cases/compiler/propertiesAndIndexers.ts(28,5): error TS2411: Property 'b' of type 'X' is not assignable to 'string' index type 'number'.
tests/cases/compiler/propertiesAndIndexers.ts(29,5): error TS2411: Property 'c' of type 'boolean' is not assignable to 'string' index type 'number'.
tests/cases/compiler/propertiesAndIndexers.ts(30,5): error TS2411: Property '3' of type 'boolean' is not assignable to 'string' index type 'number'.
tests/cases/compiler/propertiesAndIndexers.ts(33,11): error TS2411: Property '4' of type 'boolean' is not assignable to 'string' index type 'number'.
tests/cases/compiler/propertiesAndIndexers.ts(33,11): error TS2411: Property '5' of type 'string' is not assignable to 'string' index type 'number'.
tests/cases/compiler/propertiesAndIndexers.ts(33,11): error TS2411: Property '6' of type '() => string' is not assignable to 'string' index type 'number'.
tests/cases/compiler/propertiesAndIndexers.ts(33,11): error TS2413: 'number' index type 'string' is not assignable to 'string' index type 'number'.
tests/cases/compiler/propertiesAndIndexers.ts(34,5): error TS2411: Property '2' of type 'Z' is not assignable to 'number' index type 'string'.
tests/cases/compiler/propertiesAndIndexers.ts(34,5): error TS2411: Property '2' of type 'Z' is not assignable to 'string' index type 'number'.
tests/cases/compiler/propertiesAndIndexers.ts(35,5): error TS2411: Property 'Infinity' of type 'number' is not assignable to 'number' index type 'string'.
tests/cases/compiler/propertiesAndIndexers.ts(36,5): error TS2411: Property 'zoo' of type 'string' is not assignable to 'string' index type 'number'.
tests/cases/compiler/propertiesAndIndexers.ts(44,5): error TS2411: Property 't' of type 'number' is not assignable to 'string' index type 'string'.
tests/cases/compiler/propertiesAndIndexers.ts(50,5): error TS2411: Property '3' of type 'boolean' is not assignable to 'number' index type 'string'.
==== tests/cases/compiler/propertiesAndIndexers.ts (19 errors) ====
interface X { }
interface Y {
n: number;
}
interface Z {
s: string;
}
interface A {
a: Y;
b: X;
1: Z;
}
interface B extends A {
[n: number]: string;
~~~~~~~~~~~~~~~~~~~~
!!! error TS2411: Property '1' of type 'Z' is not assignable to 'number' index type 'string'.
c: boolean;
3: boolean;
~
!!! error TS2411: Property '3' of type 'boolean' is not assignable to 'number' index type 'string'.
6(): string;
~~~~~~~~~~~~
!!! error TS2411: Property '6' of type '() => string' is not assignable to 'number' index type 'string'.
}
interface B {
4: boolean;
~
!!! error TS2411: Property '4' of type 'boolean' is not assignable to 'number' index type 'string'.
5: string;
}
interface C extends A {
[s: string]: number;
~~~~~~~~~~~~~~~~~~~~
!!! error TS2411: Property '1' of type 'Z' is not assignable to 'string' index type 'number'.
~~~~~~~~~~~~~~~~~~~~
!!! error TS2411: Property 'a' of type 'Y' is not assignable to 'string' index type 'number'.
~~~~~~~~~~~~~~~~~~~~
!!! error TS2411: Property 'b' of type 'X' is not assignable to 'string' index type 'number'.
c: boolean;
~
!!! error TS2411: Property 'c' of type 'boolean' is not assignable to 'string' index type 'number'.
3: boolean;
~
!!! error TS2411: Property '3' of type 'boolean' is not assignable to 'string' index type 'number'.
}
interface D extends B, C {
~
!!! error TS2411: Property '4' of type 'boolean' is not assignable to 'string' index type 'number'.
~
!!! error TS2411: Property '5' of type 'string' is not assignable to 'string' index type 'number'.
~
!!! error TS2411: Property '6' of type '() => string' is not assignable to 'string' index type 'number'.
~
!!! error TS2413: 'number' index type 'string' is not assignable to 'string' index type 'number'.
2: Z;
~
!!! error TS2411: Property '2' of type 'Z' is not assignable to 'number' index type 'string'.
~
!!! error TS2411: Property '2' of type 'Z' is not assignable to 'string' index type 'number'.
Infinity: number;
~~~~~~~~
!!! error TS2411: Property 'Infinity' of type 'number' is not assignable to 'number' index type 'string'.
zoo: string;
~~~
!!! error TS2411: Property 'zoo' of type 'string' is not assignable to 'string' index type 'number'.
}
class P {
[n: string]: string
}
class Q extends P {
t: number;
~
!!! error TS2411: Property 't' of type 'number' is not assignable to 'string' index type 'string'.
}
var c: {
[n: number]: string;
c: boolean;
3: boolean;
~
!!! error TS2411: Property '3' of type 'boolean' is not assignable to 'number' index type 'string'.
};
|