Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Open
Description
Consider this code:
functionButton({ text}:{text:string;onClick:()=>void;}){return<button>{text}</button>;}
TheonClick
prop was accidentally omitted, and no current rule is able to catch it (that I know of). I suggest a rule, called maybefully-destructure-arguments
, which would trigger if a property is present on an object type, but is not destructured.
It (probably) shouldn't trigger for interfaces et al, only immediate inline object types. An interface may be used elsewhere, but an inline object type is only used in one place, so if it's destructured and is missing a prop, the forgotten prop is guaranteed never to be used.
Bikeshedding is welcome on the rule name or the suggestion in general.