-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
New issue
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
empty enum got undefined #15958
Comments
Start a new pull request in StackBlitz Codeflow. |
For this input, export enum Opcode {}
export function extendOpcode(key: string, value: string) {
Object.assign(Opcode, { [key]: value });
} TypeScript outputs (ts playground): export var Opcode;
(function (Opcode) {
})(Opcode || (Opcode = {}));
export function extendOpcode(key, value) {
Object.assign(Opcode, { [key]: value });
} and esbuild outputs (esbuild try): export var Opcode = /* @__PURE__ */ ((Opcode2) => {
})(Opcode || {});
export function extendOpcode(key, value) {
Object.assign(Opcode, { [key]: value });
} I don't find any bug in esbuild here. The code is working as expected ( |
It looks like esbuild's bug, I'll report it to esbuild, Thanks 🙏 |
Ah, I overlooked the |
Thank you for your information! 🙏 |
Describe the bug
I am using typescript module augmentation for enum, but got error if enum is empty at the beginning (enum would be undefined)
Reproduction
https://stackblitz.com/edit/vitejs-vite-abyiyv?file=main.js&terminal=dev
Steps to reproduce
just check reproduction link, enum would be undefined after compilation
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: