We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
--no-check
The canary build throws with the following enum (when --no-check option is passed):
export enum Encodings { ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER, BASE64URL, LATIN1 = BINARY, }
(ref: https://github.com/denoland/deno_std/blob/21e0b73979466202e738f458ff0b9232b21dd4e1/node/internal_binding/_node.ts )
It throws with ReferenceError: BINARY is not defined only when --no-check is specified.
ReferenceError: BINARY is not defined
I guess this might be related to #13025. cc @dsherret
The text was updated successfully, but these errors were encountered:
That feels like really fragile and dodgy code, but it is valid TypeScript.
Sorry, something went wrong.
I didn't know this syntax is possible until I saw the above error..
BTW std now dropped the usage of this syntax. So this issue isn't urgent from std's perspective now. denoland/std#1694
Given:
var x = 5; enum Foo { a, b = a, c = b + 1, d = 1 + c * x, e = 2 * d }
Swc:
var x = 5; var Foo; (function(Foo) { Foo[Foo["a"] = 0] = "a"; Foo[Foo["b"] = a] = "b"; Foo[Foo["c"] = b + 1] = "c"; Foo[Foo["d"] = 1 + c * x] = "d"; Foo[Foo["e"] = 2 * d] = "e"; })(Foo || (Foo = { }));
TypeScript:
var x = 5; var Foo; (function (Foo) { Foo[Foo["a"] = 0] = "a"; Foo[Foo["b"] = 0] = "b"; Foo[Foo["c"] = 1] = "c"; Foo[Foo["d"] = 1 + Foo.c * x] = "d"; Foo[Foo["e"] = 2 * Foo.d] = "e"; })(Foo || (Foo = {}));
I'll fix this.
By the way, this is done a lot for things like enum flags (ex. All = Member1 | Member2) so it is fairly common.
All = Member1 | Member2
Opened swc-project/swc#3000
dsherret
Successfully merging a pull request may close this issue.
The canary build throws with the following enum (when
--no-check
option is passed):(ref: https://github.com/denoland/deno_std/blob/21e0b73979466202e738f458ff0b9232b21dd4e1/node/internal_binding/_node.ts )
It throws with
ReferenceError: BINARY is not defined
only when--no-check
is specified.I guess this might be related to #13025. cc @dsherret
The text was updated successfully, but these errors were encountered: