Skip to content

Instantly share code, notes, and snippets.

@DistractionBoy
Created November 17, 2021 19:14
Show Gist options
  • Save DistractionBoy/6ec2ee421ed5c30724765e533dd98b8f to your computer and use it in GitHub Desktop.
Save DistractionBoy/6ec2ee421ed5c30724765e533dd98b8f to your computer and use it in GitHub Desktop.

Revisions

  1. DistractionBoy created this gist Nov 17, 2021.
    11 changes: 11 additions & 0 deletions action-map.ts
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,11 @@
    // eslint-disable-next-line @typescript-eslint/no-explicit-any
    export type ActionMap<M extends { [index: string]: any }> = {
    [Key in keyof M]: M[Key] extends undefined
    ? {
    type: Key
    }
    : {
    type: Key
    payload: M[Key]
    }
    }