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.
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.