aral, If you use a parameter object in JavaScript, even if you specify its shape using JSDoc, you’ll only get errors if required properties are missing; not if there are extra properties provided.
e.g.,
class A { /** @param {{ id:string }} params */ constructor (params) { Object.assign(this, params) } } // Error: new A({}) // No error: new A({id: 'x', foo:'bar'})
According to this thread, it’s a fact-of-life:
Add comment