File: numericStringNamedPropertyEquivalence.errors.txt

package info (click to toggle)
node-typescript 5.0.4%2Bds1-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental
  • size: 459,116 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (48 lines) | stat: -rw-r--r-- 2,615 bytes parent folder | download | duplicates (3)
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
48
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 TS1117: An object literal cannot have multiple properties with the same name.


==== 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'.
!!! related TS6203 tests/cases/conformance/types/objectTypeLiteral/propertySignatures/numericStringNamedPropertyEquivalence.ts:16:5: '1.0' was also declared here.
    }
    
    var b = {
        "0": '',
        0: ''
        ~
!!! error TS1117: An object literal cannot have multiple properties with the same name.
    }