File: typeOfEnumAndVarRedeclarations.errors.txt

package info (click to toggle)
node-typescript 4.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 396,552 kB
  • sloc: javascript: 1,444,377; makefile: 7; sh: 3
file content (24 lines) | stat: -rw-r--r-- 1,884 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(8,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'x' must be of type 'typeof E', but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'.
tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(10,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'y' must be of type 'typeof E', but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'.
tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts(10,70): error TS2375: Duplicate number index signature.


==== tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts (3 errors) ====
    enum E {
        a
    }
    enum E {
        b = 1
    }
    var x = E;
    var x: { readonly a: E; readonly b: E; readonly [x: number]: string; }; // Shouldnt error
        ~
!!! error TS2403: Subsequent variable declarations must have the same type.  Variable 'x' must be of type 'typeof E', but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'.
!!! related TS6203 tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts:7:5: 'x' was also declared here.
    var y = E;
    var y: { readonly a: E; readonly b: E; readonly [x: number]: string; readonly [x: number]: string } // two errors: the types are not identical and duplicate signatures
        ~
!!! error TS2403: Subsequent variable declarations must have the same type.  Variable 'y' must be of type 'typeof E', but here has type '{ readonly [x: number]: string; readonly a: E; readonly b: E; }'.
!!! related TS6203 tests/cases/compiler/typeOfEnumAndVarRedeclarations.ts:9:5: 'y' was also declared here.
                                                                         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2375: Duplicate number index signature.