You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
when declaring my containers props i do something like this:
// In my selector file
const simpleSelector = (state: RootState): string => state.mydata;
const reselectSelector = createSelector([simpleSelector], (selector: string): string => selector);
// In my container file
interface SimpleContainerProps {
simpleSelector: typeof simpleSelector; // this is ok because type is string
reselectSelector: typeof reselectSelector; // this gives problems because type is 'OutputSelector<RootState, string, (selector: string) => string>'
}
This gives me the opportunity to be sure that if I change a selector used by any components on my app, typescript compiler will throw an error. However as you can see from my code's comments I cant use it for selectors created by reselect using createSelector.
Does anyone encountered this problem too?
The text was updated successfully, but these errors were encountered:
marcoturi
changed the title
Type inference for reselect in containers
[Typescript] Type inference for reselect in containers
Jan 22, 2018
Digging to this issue I found that is a common problem in typescript, and even my first example (typeof simpleSelector) doesn't work, as the type is not string but (state: RootState) => string.
Hi,
when declaring my containers props i do something like this:
This gives me the opportunity to be sure that if I change a selector used by any components on my app, typescript compiler will throw an error. However as you can see from my code's comments I cant use it for selectors created by reselect using createSelector.
Does anyone encountered this problem too?
The text was updated successfully, but these errors were encountered: