-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green light
Milestone
Description
Bug Report
π Search Terms
TS2463 javascript
π Version & Regression Information
- This is the behavior in every version I tried, and I reviewed the FAQ for entries about
default
β― Playground Link
π» Code
/**
* @param [options]
*/
function test({ x = '' }) { x }
π 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:
function test({ x = '' }?) { x }
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.
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptFix AvailableA PR has been opened for this issueA PR has been opened for this issueGood First IssueWell scoped, documented and has the green lightWell scoped, documented and has the green light