46 lines
No EOL
2.8 KiB
Text
46 lines
No EOL
2.8 KiB
Text
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'.
|
|
}
|
|
|