suggestion: add info about dispatched action types
Author: arolson101Created Jan 19, 2018Updated May 18, 2026
LabelsenhancementIssueHuntin progress
When declaring a connected component's property types I find it helpful to use the typeof operator to declare dispatched function types so that the property matches the action's declaration:
const actions = {
ping: createAction('ping/PING', (arg: number) => ({
type: 'ping/PING',
arg,
})),
};
interface Props {
ping: typeof actions.ping;
}
const PingTestComponent: React.SFC<Props> = ({ping}) => {
return (
<Button onPress={() => ping(123)} title="ping"/>
);
};
export const PingTest = connect(
null,
({ ping: actions.ping })
)(PingTestComponent);IssueHunt Summary
Backers (Total: $40.00)
Submitted pull Requests
Become a backer now!
Or submit a pull request to get the deposits!
Tips
- Checkout the Issuehunt explorer to discover more funded issues.
- Need some help from other developers? Add your repositories on IssueHunt to raise funds.
Source: piotrwitek/react-redux-typescript-guide