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

@swc/wasm-typescript improve error message output #9884

Open
marco-ippolito opened this issue Jan 15, 2025 · 0 comments
Open

@swc/wasm-typescript improve error message output #9884

marco-ippolito opened this issue Jan 15, 2025 · 0 comments
Assignees
Milestone

Comments

@marco-ippolito
Copy link
Contributor

marco-ippolito commented Jan 15, 2025

Describe the feature

This is the swc error:

   x await isn't allowed in non-async function
   ,----
 1 | function foo(){ await Promise.resolve(1) }
   :                       ^^^^^^^
   `----

This is the Node.js error

function foo(){ await Promise.resolve(1) }
                ^^^^^

SyntaxError: await is only valid in async functions and the top level bodies of modules

Since we are rewrapping these error messages I'd like them to be consistent.
I'd remove the x and the blank space at its left and the dashes around the function.
Maybe splitting the message and the body as object properties would be useful

Babel plugin or link to the feature description

No response

Additional context

No response

@kdy1 kdy1 added this to the Planned milestone Jan 15, 2025
@kdy1 kdy1 self-assigned this Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants