Skip to content

Commit

Permalink
Remove unused type exports
Browse files Browse the repository at this point in the history
These types were only used internally. We can export them again if and
when that becomes useful.
  • Loading branch information
Gudahtt committed Mar 11, 2021
1 parent 3ed24a6 commit 1671284
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/ControllerMessenger.ts
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
export type ActionHandler<Action, ActionType> = (
type ActionHandler<Action, ActionType> = (
...args: ExtractActionParameters<Action, ActionType>
) => ExtractActionResponse<Action, ActionType>;
export type ExtractActionParameters<Action, T> = Action extends { type: T; handler: (...args: infer H) => any }
? H
: never;
export type ExtractActionResponse<Action, T> = Action extends { type: T; handler: (...args: any) => infer H }
? H
: never;
type ExtractActionParameters<Action, T> = Action extends { type: T; handler: (...args: infer H) => any } ? H : never;
type ExtractActionResponse<Action, T> = Action extends { type: T; handler: (...args: any) => infer H } ? H : never;

export type ExtractEvenHandler<Event, T> = Event extends { type: T; payload: infer P }
type ExtractEvenHandler<Event, T> = Event extends { type: T; payload: infer P }
? P extends any[]
? (...payload: P) => void
: never
: never;
export type ExtractEventPayload<Event, T> = Event extends { type: T; payload: infer P } ? P : never;
type ExtractEventPayload<Event, T> = Event extends { type: T; payload: infer P } ? P : never;

type ActionConstraint = { type: string; handler: (...args: any) => unknown };
type EventConstraint = { type: string; payload: unknown[] };
Expand Down

0 comments on commit 1671284

Please sign in to comment.