49 lines
1.4 KiB
Plaintext
49 lines
1.4 KiB
Plaintext
==== 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;
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2375: Duplicate number index signature.
|
|
}
|
|
|
|
interface I {
|
|
[x: number]: string;
|
|
[x: number]: string;
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2375: Duplicate number index signature.
|
|
}
|
|
|
|
var a: {
|
|
[x: number]: string;
|
|
[x: number]: string;
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2375: Duplicate number index signature.
|
|
}
|
|
|
|
var b: {
|
|
[x: number]: string;
|
|
[x: number]: string
|
|
~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2375: Duplicate number index signature.
|
|
} = { 1: '', "2": '' }
|
|
|
|
class C2<T> {
|
|
[x: number]: string;
|
|
[x: number]: string;
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2375: Duplicate number index signature.
|
|
}
|
|
|
|
interface I<T> {
|
|
~
|
|
!!! error TS2428: All declarations of an interface must have identical type parameters.
|
|
[x: number]: string;
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2375: Duplicate number index signature.
|
|
[x: number]: string;
|
|
~~~~~~~~~~~~~~~~~~~~
|
|
!!! error TS2375: Duplicate number index signature.
|
|
}
|
|
|