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

"Cannot destructure argument" error is hard to understand #10228

Open
Dimava opened this issue Apr 12, 2024 · 1 comment
Open

"Cannot destructure argument" error is hard to understand #10228

Dimava opened this issue Apr 12, 2024 · 1 comment
Labels
bug Something isn't working jsc Something related to JavaScriptCore sourcemaps

Comments

@Dimava
Copy link

Dimava commented Apr 12, 2024

What version of Bun is running?

1.1.3+2615dc742

What platform is your computer?

Microsoft Windows NT 10.0.22631.0 x64

What steps can reproduce the bug?

function foo({ a }) {
  return a
}
foo(null)

What is the expected behavior?

Anything that does not say "Right side of assignment". I spent a minute looking for the assignment

Here's what V8 gives:

Uncaught TypeError: Cannot destructure property 'a' of 'object null' as it is null.
    at foo (<anonymous>:1:16)
    at <anonymous>:4:1

What do you see instead?

1 | function foo({ a }) {
                        ^
TypeError: Right side of assignment cannot be destructured
      at foo (D:\projects\test\err.ts:1:21)
      at D:\projects\test\err.ts:4:1

Additional information

No response

@Dimava Dimava added the bug Something isn't working label Apr 12, 2024
@gvilums gvilums added the quick fix Something that can be fixed with low effort, but high impact label Apr 12, 2024
@Jarred-Sumner Jarred-Sumner removed the quick fix Something that can be fixed with low effort, but high impact label Apr 14, 2024
@Jarred-Sumner
Copy link
Collaborator

This is a JavaScriptCore bug unfortunately. Would you be able to file an issue on WebKit's bug tracker in the JavaScriptCore category?

@paperclover paperclover added jsc Something related to JavaScriptCore sourcemaps labels Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working jsc Something related to JavaScriptCore sourcemaps
Projects
None yet
Development

No branches or pull requests

4 participants