Closed marqu3z closed 3 years ago
thanks @marqu3z! I'll look into this as soon as I can. I might cut a beta release—would you be willing to test that?
@chrisbolin We may be able to retain support as it was before but satisfy typings like these by using: <A = any, B = any>(a: A, b: B) => boolean
thanks @marqu3z! I'll look into this as soon as I can. I might cut a beta release—would you be willing to test that?
Sure, no problem
see https://github.com/FormidableLabs/react-fast-compare/pull/62 as well. We may be able to use kitten's <A = any, B = any>(a: A, b: B) => boolean
, but we may have to use (a: any, b: any): boolean
. Some testing will be needed, and I think we should release a beta and have folks try it.
Important note: in order to fix the types, we need to give up the naive hope that we could ever types that statically do a comparison. e.g.
<Thing = any>(<a: Thing, b: Thing>) => boolean
We've dealt with this earlier, so I want to make sure it doesn't come back to bite us.
@chrisbolin the more I'm reading about namespace declaration, the more it seems our types are definitely broken as-is. With the namespace declaration being dead code, I'm not confident it's working the way we think it is?
kale-stew moved this from In progress to Done in May 2020 on May 28, 2020
@ryan-roemer this might be closable as well. We may not have had the automation turned on to set this ticket to closed when moving the card on the project board.
Sounds good!
It seems the typing for react redux hook
useSelector
relies on the types of the equality function to infer the return type:Using
isEqual
as equality function the compiler will inferany
asTSelected
type because:So
Declaring
isEqual
with generic types should solve the issue