|
| 1 | +tests/cases/compiler/propertiesAndIndexers2.ts(2,5): error TS2413: Numeric index type 'string' is not assignable to string index type 'number'. |
| 2 | +tests/cases/compiler/propertiesAndIndexers2.ts(8,5): error TS2411: Property 'c' of type 'string' is not assignable to string index type 'number'. |
| 3 | +tests/cases/compiler/propertiesAndIndexers2.ts(9,5): error TS2411: Property '3' of type 'string' is not assignable to string index type 'number'. |
| 4 | +tests/cases/compiler/propertiesAndIndexers2.ts(10,5): error TS2411: Property 'Infinity' of type 'string' is not assignable to string index type 'number'. |
| 5 | +tests/cases/compiler/propertiesAndIndexers2.ts(11,5): error TS2411: Property '"-Infinity"' of type 'string' is not assignable to string index type 'number'. |
| 6 | +tests/cases/compiler/propertiesAndIndexers2.ts(12,5): error TS2411: Property 'NaN' of type 'string' is not assignable to string index type 'number'. |
| 7 | +tests/cases/compiler/propertiesAndIndexers2.ts(13,5): error TS2411: Property '"-NaN"' of type 'string' is not assignable to string index type 'number'. |
| 8 | +tests/cases/compiler/propertiesAndIndexers2.ts(14,5): error TS2411: Property '6' of type '() => string' is not assignable to string index type 'number'. |
| 9 | +tests/cases/compiler/propertiesAndIndexers2.ts(14,5): error TS2412: Property '6' of type '() => string' is not assignable to numeric index type 'string'. |
| 10 | + |
| 11 | + |
| 12 | +==== tests/cases/compiler/propertiesAndIndexers2.ts (9 errors) ==== |
| 13 | + interface A { |
| 14 | + [n: number]: string; |
| 15 | + ~~~~~~~~~~~~~~~~~~~~ |
| 16 | +!!! error TS2413: Numeric index type 'string' is not assignable to string index type 'number'. |
| 17 | + [s: string]: number; |
| 18 | + } |
| 19 | + |
| 20 | + // All of these should fail. |
| 21 | + interface B extends A { |
| 22 | + c: string; |
| 23 | + ~~~~~~~~~~ |
| 24 | +!!! error TS2411: Property 'c' of type 'string' is not assignable to string index type 'number'. |
| 25 | + 3: string; |
| 26 | + ~~~~~~~~~~ |
| 27 | +!!! error TS2411: Property '3' of type 'string' is not assignable to string index type 'number'. |
| 28 | + Infinity: string; |
| 29 | + ~~~~~~~~~~~~~~~~~ |
| 30 | +!!! error TS2411: Property 'Infinity' of type 'string' is not assignable to string index type 'number'. |
| 31 | + "-Infinity": string; |
| 32 | + ~~~~~~~~~~~~~~~~~~~~ |
| 33 | +!!! error TS2411: Property '"-Infinity"' of type 'string' is not assignable to string index type 'number'. |
| 34 | + NaN: string; |
| 35 | + ~~~~~~~~~~~~ |
| 36 | +!!! error TS2411: Property 'NaN' of type 'string' is not assignable to string index type 'number'. |
| 37 | + "-NaN": string; |
| 38 | + ~~~~~~~~~~~~~~~ |
| 39 | +!!! error TS2411: Property '"-NaN"' of type 'string' is not assignable to string index type 'number'. |
| 40 | + 6(): string; |
| 41 | + ~~~~~~~~~~~~ |
| 42 | +!!! error TS2411: Property '6' of type '() => string' is not assignable to string index type 'number'. |
| 43 | + ~~~~~~~~~~~~ |
| 44 | +!!! error TS2412: Property '6' of type '() => string' is not assignable to numeric index type 'string'. |
| 45 | + } |
| 46 | + |
0 commit comments