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 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
|
tests/cases/compiler/duplicateIdentifierEnum_A.ts(2,6): error TS2567: Enum declarations can only merge with namespace or other enum declarations.
tests/cases/compiler/duplicateIdentifierEnum_A.ts(5,7): error TS2567: Enum declarations can only merge with namespace or other enum declarations.
tests/cases/compiler/duplicateIdentifierEnum_A.ts(9,11): error TS2567: Enum declarations can only merge with namespace or other enum declarations.
tests/cases/compiler/duplicateIdentifierEnum_A.ts(12,12): error TS2567: Enum declarations can only merge with namespace or other enum declarations.
tests/cases/compiler/duplicateIdentifierEnum_A.ts(16,12): error TS2567: Enum declarations can only merge with namespace or other enum declarations.
tests/cases/compiler/duplicateIdentifierEnum_A.ts(19,10): error TS2567: Enum declarations can only merge with namespace or other enum declarations.
tests/cases/compiler/duplicateIdentifierEnum_A.ts(23,6): error TS2567: Enum declarations can only merge with namespace or other enum declarations.
tests/cases/compiler/duplicateIdentifierEnum_A.ts(26,7): error TS2567: Enum declarations can only merge with namespace or other enum declarations.
tests/cases/compiler/duplicateIdentifierEnum_B.ts(1,10): error TS2567: Enum declarations can only merge with namespace or other enum declarations.
tests/cases/compiler/duplicateIdentifierEnum_B.ts(4,6): error TS2567: Enum declarations can only merge with namespace or other enum declarations.
==== tests/cases/compiler/duplicateIdentifierEnum_A.ts (8 errors) ====
// Test the error message when attempting to merge an enum with a class, an interface, or a function.
enum A {
~
!!! error TS2567: Enum declarations can only merge with namespace or other enum declarations.
bar
}
class A {
~
!!! error TS2567: Enum declarations can only merge with namespace or other enum declarations.
foo: number;
}
interface B {
~
!!! error TS2567: Enum declarations can only merge with namespace or other enum declarations.
foo: number;
}
const enum B {
~
!!! error TS2567: Enum declarations can only merge with namespace or other enum declarations.
bar
}
const enum C {
~
!!! error TS2567: Enum declarations can only merge with namespace or other enum declarations.
}
function C() {
~
!!! error TS2567: Enum declarations can only merge with namespace or other enum declarations.
return 0;
}
enum D {
~
!!! error TS2567: Enum declarations can only merge with namespace or other enum declarations.
!!! related TS6203 tests/cases/compiler/duplicateIdentifierEnum_B.ts:1:10: 'D' was also declared here.
bar
}
class E {
~
!!! error TS2567: Enum declarations can only merge with namespace or other enum declarations.
!!! related TS6203 tests/cases/compiler/duplicateIdentifierEnum_B.ts:4:6: 'E' was also declared here.
foo: number;
}
// also make sure the error appears when trying to merge an enum in a separate file.
==== tests/cases/compiler/duplicateIdentifierEnum_B.ts (2 errors) ====
function D() {
~
!!! error TS2567: Enum declarations can only merge with namespace or other enum declarations.
!!! related TS6203 tests/cases/compiler/duplicateIdentifierEnum_A.ts:23:6: 'D' was also declared here.
return 0;
}
enum E {
~
!!! error TS2567: Enum declarations can only merge with namespace or other enum declarations.
!!! related TS6203 tests/cases/compiler/duplicateIdentifierEnum_A.ts:26:7: 'E' was also declared here.
bar
}
|