I’m trying to understand how the reselect method createStructuredSelector works in Typescript. I see this pattern a lot:
export interface SomeProps {
readonly property1: string;
readonly property2: boolean;
readonly property3: number;
}
export interface SomeOwnProps {
readonly property3: number;
}
export const someSelector = createStructuredSelector<
SomeState,
SomeOwnProps,
SomeProps
>({
property1: property1Selector,
property2: property2Selector,
property3: (_, props) => props.property3
});
I don’t understand the purpose of the types inside of the angle brackets. I think SomeState is the Redux store state, SomeOwnProps are the props that were passed in by the parent component, and SomeProps are all the props that this component uses. But what is the difference between SomeOwnProps and SomeProps, and why do you need both? How come you can’t just use SomeProps since it also contains the properties defined in SomeOwnProps? Thanks!