-
Notifications
You must be signed in to change notification settings - Fork 80
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript typings of EqualityFn
#73
Comments
I'll get onto this soon |
I suspect this would be sufficient:
Do you think the readonly part will cause issues? |
having a strong type on the equality function might be a bit lame for consumers |
I made an example snippet:
This will result in TS error:
I'm not sure how I -as a user- could type it correctly for TS. I think its obvious for users that the arguments should not be adjusted and that just 'any' should be fine. |
I think this should be fine then: type EqualityFn = (newArgs: any[], lastArgs: any[]) => boolean; it is fairly loose, but i don't think the friction is worth typing it stricter for now |
Fixed in 5.1.1 |
The arguments of
EqualityFn
are defined as beingunknown
even though they are known (i.e. the same as ...newArgs of ResultFn).Our build did fail today due to the recently added TypeScript types. My suggestion would be to type the args of
EqualityFn
as any (just like the typings on DefinitelyTyped did which does make that users do not have to cast the unknown type) or to strong-type it, e.g.:The text was updated successfully, but these errors were encountered: