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
|
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(6,5): error TS2300: Duplicate identifier '1.0'.
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(10,5): error TS2300: Duplicate identifier '1'.
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(12,5): error TS2300: Duplicate identifier '1'.
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(16,5): error TS2300: Duplicate identifier '1'.
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2300: Duplicate identifier '1'.
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(17,5): error TS2717: Subsequent property declarations must have the same type. Property '1.0' must be of type 'number', but here has type 'string'.
tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts(22,5): error TS2300: Duplicate identifier '0'.
==== tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts (7 errors) ====
// Each of these types has an error in it.
// String named and numeric named properties conflict if they would be equivalent after ToNumber on the property name.
class C {
"1": number;
"1.0": number; // not a duplicate
1.0: number;
~~~
!!! error TS2300: Duplicate identifier '1.0'.
}
interface I {
"1": number;
~~~
!!! error TS2300: Duplicate identifier '1'.
"1.": number; // not a duplicate
1: number;
~
!!! error TS2300: Duplicate identifier '1'.
}
var a: {
"1": number;
~~~
!!! error TS2300: Duplicate identifier '1'.
1.0: string;
~~~
!!! error TS2300: Duplicate identifier '1'.
~~~
!!! error TS2717: Subsequent property declarations must have the same type. Property '1.0' must be of type 'number', but here has type 'string'.
}
var b = {
"0": '',
0: ''
~
!!! error TS2300: Duplicate identifier '0'.
}
|