Open
Description
Here's a rough example:
// actions.ts
import actionCreatorFactory from 'typescript-fsa';
const actionCreator = actionCreatorFactory('tasks');
export const allDone = actionCreator('MARK_ALL_DONE');
export const markDone = actionCreator<number>('MARK_DONE');
// Tasks.tsx
interface ITasksProps = {
allDone: () => void;
markDone: (taskId: number) => void;
}
...
// TasksContainer.tsx
import Tasks from './Tasks'
import { allDone, markDone } from './actions';
...
const mapDispatchToProps = {
allDone,
markDone,
};
connect(null, mapDispatchToProps)(Tasks);
Here's an error:
Type 'ActionCreator<void>' is not assignable to type '() => void'. TS2345
To fix it, I have to change this:
allDone: () => void;
To this:
allDone: (payload: void) => void;
Which is stupid.
Metadata
Metadata
Assignees
Labels
No labels