Skip to content

Instantly share code, notes, and snippets.

@matthew-gerstman
Created August 23, 2018 14:49
Show Gist options
  • Select an option

  • Save matthew-gerstman/d39a0f0ffe2abff61ff057ca94fa4765 to your computer and use it in GitHub Desktop.

Select an option

Save matthew-gerstman/d39a0f0ffe2abff61ff057ca94fa4765 to your computer and use it in GitHub Desktop.
//redux-utils/types.ts
import { MuggleNamespaceShape } from "../data/muggles/types";
import { WizardNamespaceShape } from "../data/wizards/types";
import { Reducer } from "redux";
export const MUGGLE_NAMESPACE_KEY = "MUGGLE_NAMESPACE";
export const WIZARD_NAMESPACE_KEY = "WIZARD_NAMESPACE";
export type FullStoreShape = {
[MUGGLE_NAMESPACE_KEY]: MuggleNamespaceShape;
[WIZARD_NAMESPACE_KEY]: WizardNamespaceShape;
};
export type StoreShape = Partial<FullStoreShape>;
export type NamespaceKey = keyof StoreShape;
export type ReducerMap = Partial<
{ [k in NamespaceKey]: Reducer<StoreShape[k]> }
>;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment