dai-shi / use-context-selector

React useContextSelector hook in userland
https://www.npmjs.com/package/use-context-selector
MIT License
2.68k stars 61 forks source link

Type error in useContextSelector #88

Closed tbakerx closed 2 years ago

tbakerx commented 2 years ago
if('v' in action) {}

Doesn't provide type safety to the compiler resulting in action.v remaining as type Value | undefined. This then throws type errors where v is expected to be type Value only

Screen Shot 2022-08-03 at 12 00 40 PM
tbakerx commented 2 years ago

Mistaken, "exactOptionalPropertyTypes": true, compiler option makes this valid