-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
No error in JavaScript on optional binding pattern parameter #49869
Comments
Instead, use |
Thanks for looking into this @sandersn!
Should I create a feature request / new issue for this? |
Oh, I misread the whole thing. I'll re-open. |
I supposed that it's working as intended. |
That's true, but with /**
* @param [options]
*/ added to the JavaScript function you can suppress type errors that would otherwise warn you about the potential runtime error. |
Bug Report
π Search Terms
TS2463 javascript
π Version & Regression Information
default
β― Playground Link
π» Code
π Actual behavior
No error on
{ x = '' }
.π Expected behavior
Error 2463: "A binding pattern parameter cannot be optional in an implementation signature."
The equivalent Typescript has the correct error:
Note that in the playground link I have checked all options that are supposed to make types more strict. Also note that when this code is run, you'll end up with a runtime error. The same is true for the TypeScript equivalent, but in that case you get an error in advance warning you that the code you wrote will cause issues.
The text was updated successfully, but these errors were encountered: