TypeScript typings of `EqualityFn`
See original GitHub issueThe arguments of EqualityFn
are defined as being unknown
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.:
export type EqualityFn<Args = any> = (
newArgs: Args,
lastArgs: Args,
) => boolean;
export default function memoizeOne<
ResultFn extends (this: any, ...newArgs: T) => ReturnType<ResultFn>,
T extends any[]
>(resultFn: ResultFn, isEqual: EqualityFn<T> = areInputsEqual): ResultFn {
...
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Documentation - Advanced Types - TypeScript
Advanced concepts around types in TypeScript. ... Union types are useful for modeling situations when values can overlap in the types they can...
Read more >React-Redux useSelector typescript type for state
In this video, Mark Erikson shows how to create some custom useAppSelector and useAppDispatch, to give them the correct types ...
Read more >Typescript and Redux. My tips. - DEV Community
Typescript and Redux. Both helps to develop fault tolerant applications. There is a lot of approaches to write typings of state and actions....
Read more >types/react-redux/index.d.ts - UNPKG
The CDN for @types/react-redux. ... Omit taken from https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-8.html ... 561, equalityFn?:
Read more >reselect - npm
TypeScript icon, indicating that this package has built-in type declarations. 4.1.7 • Public • Published 9 days ago.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Fixed in 5.1.1
I think this should be fine then:
it is fairly loose, but i don’t think the friction is worth typing it stricter for now