@@ -3,13 +3,17 @@ tests/cases/conformance/enums/enumErrors.ts(3,6): error TS2431: Enum name cannot
3
3
tests/cases/conformance/enums/enumErrors.ts(4,6): error TS2431: Enum name cannot be 'string'.
4
4
tests/cases/conformance/enums/enumErrors.ts(5,6): error TS2431: Enum name cannot be 'boolean'.
5
5
tests/cases/conformance/enums/enumErrors.ts(9,9): error TS2322: Type 'Number' is not assignable to type 'E5'.
6
- tests/cases/conformance/enums/enumErrors.ts(26,9): error TS2322: Type '"" ' is not assignable to type 'E11'.
6
+ tests/cases/conformance/enums/enumErrors.ts(26,9): error TS2322: Type 'true ' is not assignable to type 'E11'.
7
7
tests/cases/conformance/enums/enumErrors.ts(27,9): error TS2322: Type 'Date' is not assignable to type 'E11'.
8
8
tests/cases/conformance/enums/enumErrors.ts(28,9): error TS2304: Cannot find name 'window'.
9
9
tests/cases/conformance/enums/enumErrors.ts(29,9): error TS2322: Type '{}' is not assignable to type 'E11'.
10
+ tests/cases/conformance/enums/enumErrors.ts(35,9): error TS2551: Computed values are not permitted in an enum with string valued members.
11
+ tests/cases/conformance/enums/enumErrors.ts(36,9): error TS2551: Computed values are not permitted in an enum with string valued members.
12
+ tests/cases/conformance/enums/enumErrors.ts(37,9): error TS2551: Computed values are not permitted in an enum with string valued members.
13
+ tests/cases/conformance/enums/enumErrors.ts(38,9): error TS2551: Computed values are not permitted in an enum with string valued members.
10
14
11
15
12
- ==== tests/cases/conformance/enums/enumErrors.ts (9 errors) ====
16
+ ==== tests/cases/conformance/enums/enumErrors.ts (13 errors) ====
13
17
// Enum named with PredefinedTypes
14
18
enum any { }
15
19
~~~
@@ -45,9 +49,9 @@ tests/cases/conformance/enums/enumErrors.ts(29,9): error TS2322: Type '{}' is no
45
49
46
50
// Enum with computed member intializer of other types
47
51
enum E11 {
48
- A = '' ,
49
- ~~
50
- !!! error TS2322: Type '"" ' is not assignable to type 'E11'.
52
+ A = true ,
53
+ ~~~~
54
+ !!! error TS2322: Type 'true ' is not assignable to type 'E11'.
51
55
B = new Date(),
52
56
~~~~~~~~~~
53
57
!!! error TS2322: Type 'Date' is not assignable to type 'E11'.
@@ -58,4 +62,21 @@ tests/cases/conformance/enums/enumErrors.ts(29,9): error TS2322: Type '{}' is no
58
62
~~
59
63
!!! error TS2322: Type '{}' is not assignable to type 'E11'.
60
64
}
65
+
66
+ // Enum with string valued member and computed member initializers
67
+ enum E12 {
68
+ A = '',
69
+ B = new Date(),
70
+ ~~~~~~~~~~
71
+ !!! error TS2551: Computed values are not permitted in an enum with string valued members.
72
+ C = window,
73
+ ~~~~~~
74
+ !!! error TS2551: Computed values are not permitted in an enum with string valued members.
75
+ D = {},
76
+ ~~
77
+ !!! error TS2551: Computed values are not permitted in an enum with string valued members.
78
+ E = 1 + 1,
79
+ ~~~~~
80
+ !!! error TS2551: Computed values are not permitted in an enum with string valued members.
81
+ }
61
82
0 commit comments