piotrwitek/typesafe-actions
The issue has been solved
action property type broken with @types/react-redux 6.0.0 + Redux 4 + React Redux 5.0.20 #42
changLiuUNSW posted onGitHub
Version: Redux 4 + React Redux 5.0.20 + typesafe-actions 2.0.2+ types/react-redux 6.0.0
For example:
todoAction:
const load = createAction("[Todo] Load Todo Item");
Container:
export interface Props {
load: () => void;
}
const TodoContainer = ({load}: Props) => {
return (
<div>
<button onClick={load}>load item</button>
</div>
);
};
export default connect(null, {
load: todoAction.load
})(TodoContainer);
Error:
[ts]
Argument of type '({ load }: Props) => Element' is not assignable to parameter of type 'ComponentType<Shared<{ items: Todo[];
loading: boolean; } & { load: () => { type: "[Todo] Load To...'.
Type '({ load }: Props) => Element' is not assignable to type 'StatelessComponent<Shared<{ items: Todo[]; loading: boolean; } & { load: () => { type: "[Todo] Lo...'.
Types of parameters '__0' and 'props' are incompatible.
Type 'Shared<{ items: Todo[]; loading: boolean; } & { load: () => { type: "[Todo] Load Todo Item"; }; }...' is not assignable to type 'Props'.
Property 'load' is optional in type 'Shared<{ items: Todo[]; loading: boolean; } & { load: () => { type: "[Todo] Load Todo Item"; }; }...' but required in type 'Props'.
Fund this Issue
Rewarded pull request
Big project update v3 #99submitted bypiotrwitek(783)
Click to copy link
Recent activities