49 lines
No EOL
1.3 KiB
Text
49 lines
No EOL
1.3 KiB
Text
==== tests/cases/conformance/types/objectTypeLiteral/indexSignatures/multipleNumericIndexers.ts (8 errors) ====
|
|
// Multiple indexers of the same type are an error
|
|
|
|
class C {
|
|
[x: number]: string;
|
|
[x: number]: string;
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! Duplicate number index signature.
|
|
}
|
|
|
|
interface I {
|
|
[x: number]: string;
|
|
[x: number]: string;
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! Duplicate number index signature.
|
|
}
|
|
|
|
var a: {
|
|
[x: number]: string;
|
|
[x: number]: string;
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! Duplicate number index signature.
|
|
}
|
|
|
|
var b: {
|
|
[x: number]: string;
|
|
[x: number]: string
|
|
~~~~~~~~~~~~~~~~~~~
|
|
!!! Duplicate number index signature.
|
|
} = { 1: '', "2": '' }
|
|
|
|
class C2<T> {
|
|
[x: number]: string;
|
|
[x: number]: string;
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! Duplicate number index signature.
|
|
}
|
|
|
|
interface I<T> {
|
|
~
|
|
!!! All declarations of an interface must have identical type parameters.
|
|
[x: number]: string;
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! Duplicate number index signature.
|
|
[x: number]: string;
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! Duplicate number index signature.
|
|
}
|
|
|