react-redux-typescript-guide
react-redux-typescript-guide copied to clipboard
src/hoc/connected-with-count.tsx type cast is incorrect
trafficstars
Description
using as BaseProps is incorrect on this line, isn't it? Shouldn't that be as Diff<BaseProps, InjectedProps>? https://github.com/piotrwitek/react-redux-typescript-guide/blob/master/playground/src/hoc/with-connected-count.tsx#L43
As far as I can tell all properties of InjectedProps have been removed on line 37, and restProps now contains only those properties which would be in Diff<BaseProps, InjectedProps>.
Suggested solution(s)
Maybe on line 23 or line 29, add:
type RemainingProps = Diff<BaseProps, InjectedProps>
And then use it as the cast type on line 43, and use it again on line 52.