Skip to content
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

Throw error for TypeScript declare const enum #11410

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 4 additions & 4 deletions packages/babel-plugin-transform-typescript/src/enum.js
Expand Up @@ -3,15 +3,15 @@ import { template } from "@babel/core";

export default function transpileEnum(path, t) {
const { node } = path;
if (node.const) {
throw path.buildCodeFrameError("'const' enums are not supported.");
}

if (node.declare) {
path.remove();
return;
}

if (node.const) {
throw path.buildCodeFrameError("'const' enums are not supported.");
}

const name = node.id.name;
const fill = enumFill(path, t, node.id);

Expand Down
@@ -0,0 +1 @@
declare const enum E {}
@@ -0,0 +1 @@
{ "throws": "'const' enums are not supported." }