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

fix: wrap anonymous class expression within statement #15113

Merged
merged 2 commits into from Nov 3, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Expand Up @@ -531,7 +531,7 @@ export default declare((api, opts: Options) => {
nodeWithoutSpread.right = t.identifier(refName);
nodes.push(t.expressionStatement(nodeWithoutSpread));
nodes.push(
t.toStatement(
t.expressionStatement(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

toStatement wraps assignment expression within expression statement.

t.assignmentExpression("=", argument, callExpression),
),
);
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-transform-jscript/src/index.ts
Expand Up @@ -19,7 +19,7 @@ export default declare(api => {
null,
[],
t.blockStatement([
// @ts-expect-error fixme: t.toStatement may return false
// @ts-expect-error t.toStatement must return a FunctionDeclaration if node.id is defined
t.toStatement(node),
t.returnStatement(t.cloneNode(node.id)),
]),
Expand Down