Typescript definition files don't support alternate array argument.
This is valid, and used several times in the README, but is not currently supported by definition files:
createSelector(
[
(state) => state.get('stuff'),
],
(stuff) => {
}
)
+1
This is turning out to be very difficult, and may not be possible. I'll keep looking at it. One approach involves doubling the size of the declaration files (taking the same approach as the current files).
Oh, you know what, I think I was already aware of this, sorry! 😳
https://github.com/reactjs/reselect/issues/27
If it is impossible, maybe we should add something to the docs encouraging people to use the variadic version for type checkers.
Got it. Today I learned about tuples.
function createSelector<
TInput, TProps, TOutput,
T1,
T2
>(
selectors: [
Selector<TInput, TProps, T1>,
Selector<TInput, TProps, T2>
],
combiner: (
arg1: T1,
arg2: T2
) => TOutput
): Selector<TInput, TProps, TOutput>;
It's verbose, but both versions can be supported. I'll test and pull request soon.
Hey, well done! Sounds good.
https://github.com/reactjs/reselect/pull/143
Going to close this as the conversation has moved to #143