Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewbranch committed Mar 27, 2024
1 parent ed0ea55 commit 2035fc6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
bad.ts(4,5): error TS18056: Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled.
bad.ts(7,5): error TS1061: Enum member must have initializer.


==== ./helpers.ts (0 errors) ====
export const foo = 2;

==== ./bad.ts (1 errors) ====
==== ./bad.ts (2 errors) ====
import { foo } from "./helpers";
enum A {
a = foo,
b,
~
!!! error TS18056: Enum member following a non-literal numeric member must have an initializer when 'isolatedModules' is enabled.
c = 10,
d = (c)! satisfies number as any,
e,
~
!!! error TS1061: Enum member must have initializer.
}

==== ./good.ts (0 errors) ====
Expand Down Expand Up @@ -38,7 +44,5 @@ bad.ts(4,5): error TS18056: Enum member following a non-literal numeric member m
d,
e = d | b,
f,
g = (f | a)! satisfies number as any,
h,
}

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import { foo } from "./helpers";
enum A {
a = foo,
b,
c = 10,
d = (c)! satisfies number as any,
e,
}

//// [good.ts]
Expand Down Expand Up @@ -35,8 +38,6 @@ enum E {
d,
e = d | b,
f,
g = (f | a)! satisfies number as any,
h,
}


Expand All @@ -53,6 +54,9 @@ var A;
(function (A) {
A[A["a"] = 2] = "a";
A[A["b"] = 3] = "b";
A[A["c"] = 10] = "c";
A[A["d"] = (A.c)] = "d";
A[A["e"] = void 0] = "e";
})(A || (A = {}));
//// [good.js]
"use strict";
Expand Down Expand Up @@ -86,6 +90,4 @@ var E;
E[E["d"] = 1] = "d";
E[E["e"] = 1] = "e";
E[E["f"] = 2] = "f";
E[E["g"] = 2] = "g";
E[E["h"] = 3] = "h";
})(E || (E = {}));
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ import { foo } from "./helpers";
enum A {
a = foo,
b,
c = 10,
d = (c)! satisfies number as any,
e,
}

// @filename: ./good.ts
Expand Down Expand Up @@ -36,6 +39,4 @@ enum E {
d,
e = d | b,
f,
g = (f | a)! satisfies number as any,
h,
}

0 comments on commit 2035fc6

Please sign in to comment.