File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change
1
+ // @strict : true
2
+
3
+ // Repro from #31771
4
+
5
+ enum E1 { ONE , TWO , THREE }
6
+ declare enum E2 { ONE , TWO , THREE }
7
+
8
+ type Bins1 = { [ k in E1 ] ?: string ; }
9
+ type Bins2 = { [ k in E2 ] ?: string ; }
10
+
11
+ const b1 : Bins1 = { } ;
12
+ const b2 : Bins2 = { } ;
13
+
14
+ const e1 : E1 = E1 . ONE ;
15
+ const e2 : E2 = E2 . ONE ;
16
+
17
+ b1 [ 1 ] = "a" ;
18
+ b1 [ e1 ] = "b" ;
19
+
20
+ b2 [ 1 ] = "a" ;
21
+ b2 [ e2 ] = "b" ;
22
+
23
+ // Multiple numeric enum types accrue to the same numeric index signature in a mapped type
24
+
25
+ declare function val ( ) : number ;
26
+
27
+ enum N1 { A = val ( ) , B = val ( ) }
28
+ enum N2 { C = val ( ) , D = val ( ) }
29
+
30
+ type T1 = { [ K in N1 | N2 ] : K } ;
31
+
32
+ // Enum types with string valued members are always literal enum types and therefore
33
+ // ONE and TWO below are not computed members but rather just numerically valued members
34
+ // with auto-incremented values.
35
+
36
+ declare enum E { ONE , TWO , THREE = 'x' }
37
+ const e : E = E . ONE ;
38
+ const x : E . ONE = e ;
You can’t perform that action at this time.
0 commit comments