Skip to content

Commit

Permalink
Simplify ActionCreator type
Browse files Browse the repository at this point in the history
Since microsoft/TypeScript#27522 trailing void arguments may be omitted
  • Loading branch information
aikoven committed Sep 8, 2019
1 parent 6f3b438 commit ea58619
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,7 @@ export type ActionCreator<Payload> = {
* @param meta Action metadata. Merged with `commonMeta` of Action Creator.
*/
(payload: Payload, meta?: Meta): Action<Payload>;
} & (Payload extends void
? {
/**
* Creates action with given payload and metadata.
*
* @param payload Action payload.
* @param meta Action metadata. Merged with `commonMeta` of Action Creator.
*/
(payload?: Payload, meta?: Meta): Action<Payload>;
}
: {}
);
};

export type Success<Params, Result> =
({params: Params} | (Params extends void ? {params?: Params} : never)) &
Expand Down

0 comments on commit ea58619

Please sign in to comment.