Created
May 12, 2020 08:27
-
-
Save theory-of-soul/90d9bdd3827faec28c4f63476651042d to your computer and use it in GitHub Desktop.
good typings for redux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { AnyAction } from "redux"; | |
export type Wizard = { | |
name: string; | |
parentsAlive: boolean; | |
spells: string[]; | |
}; | |
export const enum WizardActionTypes { | |
LearnSpell = "WIZARD/LEARN_SPELL", | |
KillParents = "WIZARD/KILL_PARENTS" | |
} | |
export type WizardNamespaceShape = { | |
[id: string]: Wizard; | |
}; | |
export interface LearnSpellAction extends AnyAction { | |
type: WizardActionTypes.LearnSpell; | |
payload: { id: string; spell: string }; | |
} | |
export interface KillParentsAction extends AnyAction { | |
type: WizardActionTypes.KillParents; | |
payload: { id: string }; | |
} | |
export type WizardAction = LearnSpellAction | KillParentsAction; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment