-
Notifications
You must be signed in to change notification settings - Fork 672
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 createSelector with more than 12 selectors #378
Comments
I recommend creating a wrapper component with it's own selector that wraps the child component. Then passing up to 12 props down to the child component that would otherwise need more than 12 selectors. This approach gives you up to 24 selectors, personally I have never needed more than that with the code base I'm working with. |
Ran into this issue too. Typescript 3.0 supports expanding parameters. Might be it is possible? https://blogs.msdn.microsoft.com/typescript/2018/07/30/announcing-typescript-3-0/ // TODO (billg): 5 overloads should *probably* be enough for anybody?
function call<T1, T2, T3, T4, R>(fn: (param1: T1, param2: T2, param3: T3, param4: T4) => R, param1: T1, param2: T2, param3: T3, param4: T4): R
function call<T1, T2, T3, R>(fn: (param1: T1, param2: T2, param3: T3) => R, param1: T1, param2: T2, param3: T3): R
function call<T1, T2, R>(fn: (param1: T1, param2: T2) => R, param1: T1, param2: T2): R
function call<T1, R>(fn: (param1: T1) => R, param1: T1): R;
function call<R>(fn: () => R, param1: T1): R;
function call(fn: (...args: any[]) => any, ...args: any[]) {
return fn(...args);
} With spreading parameter list: function call<TS extends any[], R>(fn: (...args: TS) => R, ...args: TS): R {
return fn(...args);
} |
@prabirshrestha Exactly that is currently being discussed here: |
is there any workaround in the meantime? have 2 selectors that are maxed out essentially? |
@kelly-tock : I just published https://github.com/reduxjs/reselect/releases/tag/v4.1.0-alpha.0 , which rewrites the typedefs to use variadic args rather than a fixed list of overloads. Does that happen to improve your situation? Also, do you have a code sample you could paste in of using that many selectors at once? |
Resolved by #486 . |
Hello,
The definition file has the
createSelector
with a maximum of 12 selectors.For people who need more than 12, it does not work. Do you have any guidance? Thank you
The text was updated successfully, but these errors were encountered: