1
- tests/cases/compiler/enumAssignmentCompat3.ts(37 ,1): error TS2322: Type 'Abcd.E' is not assignable to type 'First.E'.
1
+ tests/cases/compiler/enumAssignmentCompat3.ts(49 ,1): error TS2322: Type 'Abcd.E' is not assignable to type 'First.E'.
2
2
Property 'd' is missing in type 'First.E'.
3
- tests/cases/compiler/enumAssignmentCompat3.ts(39 ,1): error TS2322: Type 'Cd.E' is not assignable to type 'First.E'.
3
+ tests/cases/compiler/enumAssignmentCompat3.ts(51 ,1): error TS2322: Type 'Cd.E' is not assignable to type 'First.E'.
4
4
Property 'd' is missing in type 'First.E'.
5
- tests/cases/compiler/enumAssignmentCompat3.ts(40 ,1): error TS2322: Type 'Nope' is not assignable to type 'E'.
6
- tests/cases/compiler/enumAssignmentCompat3.ts(43 ,1): error TS2322: Type 'First.E' is not assignable to type 'Ab.E'.
5
+ tests/cases/compiler/enumAssignmentCompat3.ts(52 ,1): error TS2322: Type 'Nope' is not assignable to type 'E'.
6
+ tests/cases/compiler/enumAssignmentCompat3.ts(56 ,1): error TS2322: Type 'First.E' is not assignable to type 'Ab.E'.
7
7
Property 'c' is missing in type 'Ab.E'.
8
- tests/cases/compiler/enumAssignmentCompat3.ts(44 ,1): error TS2322: Type 'First.E' is not assignable to type 'Cd.E'.
8
+ tests/cases/compiler/enumAssignmentCompat3.ts(57 ,1): error TS2322: Type 'First.E' is not assignable to type 'Cd.E'.
9
9
Property 'a' is missing in type 'Cd.E'.
10
- tests/cases/compiler/enumAssignmentCompat3.ts(45,1): error TS2322: Type 'E' is not assignable to type 'Nope'.
10
+ tests/cases/compiler/enumAssignmentCompat3.ts(58,1): error TS2322: Type 'E' is not assignable to type 'Nope'.
11
+ tests/cases/compiler/enumAssignmentCompat3.ts(62,1): error TS2322: Type 'Const.E' is not assignable to type 'First.E'.
12
+ tests/cases/compiler/enumAssignmentCompat3.ts(63,1): error TS2322: Type 'First.E' is not assignable to type 'Const.E'.
11
13
12
14
13
- ==== tests/cases/compiler/enumAssignmentCompat3.ts (6 errors) ====
15
+ ==== tests/cases/compiler/enumAssignmentCompat3.ts (8 errors) ====
14
16
namespace First {
15
17
export enum E {
16
18
a, b, c,
@@ -39,13 +41,25 @@ tests/cases/compiler/enumAssignmentCompat3.ts(45,1): error TS2322: Type 'E' is n
39
41
c, d,
40
42
}
41
43
}
44
+ namespace Const {
45
+ export const enum E {
46
+ a, b, c,
47
+ }
48
+ }
49
+ namespace Decl {
50
+ export declare enum E {
51
+ a, b, c = 3,
52
+ }
53
+ }
42
54
43
55
var abc: First.E;
44
56
var secondAbc: Abc.E;
45
57
var secondAbcd: Abcd.E;
46
58
var secondAb: Ab.E;
47
59
var secondCd: Cd.E;
48
60
var nope: Abc.Nope;
61
+ var k: Const.E;
62
+ var decl: Decl.E;
49
63
abc = secondAbc; // ok
50
64
abc = secondAbcd; // missing 'd'
51
65
~~~
@@ -59,6 +73,7 @@ tests/cases/compiler/enumAssignmentCompat3.ts(45,1): error TS2322: Type 'E' is n
59
73
abc = nope; // nope!
60
74
~~~
61
75
!!! error TS2322: Type 'Nope' is not assignable to type 'E'.
76
+ abc = decl; // ok
62
77
secondAbc = abc; // ok
63
78
secondAbcd = abc; // ok
64
79
secondAb = abc; // missing 'c'
@@ -72,4 +87,13 @@ tests/cases/compiler/enumAssignmentCompat3.ts(45,1): error TS2322: Type 'E' is n
72
87
nope = abc; // nope!
73
88
~~~~
74
89
!!! error TS2322: Type 'E' is not assignable to type 'Nope'.
90
+ decl = abc; // ok
91
+
92
+ k = k; // const is only assignable to itself
93
+ abc = k; // error
94
+ ~~~
95
+ !!! error TS2322: Type 'Const.E' is not assignable to type 'First.E'.
96
+ k = abc;
97
+ ~
98
+ !!! error TS2322: Type 'First.E' is not assignable to type 'Const.E'.
75
99
0 commit comments