Last active
April 16, 2019 10:10
-
-
Save theory-of-soul/081084067f0cc6b8ed94299a4d7be02e to your computer and use it in GitHub Desktop.
Typed immutable map for redux state
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
type StateType = { | |
router: RouterState; | |
someReducer: Immutable.Map<keyof SomeReducerType, SomeReducerType[keyof SomeReducerType]>; | |
} | |
export interface AppStateInterface extends Immutable.Map<string, any> { | |
toJS(): StateType; | |
get<K extends keyof StateType>(key: K, notSetValue?: StateType[K]): StateType[K]; | |
set<K extends keyof StateType>(key: K, value: StateType[K]): this; | |
has(key: string): key is keyof StateType; | |
merge(...collections: Array<Partial<StateType> | Iterable<[string, any]>>): this; | |
mergeDeep(...collections: Array<Partial<StateType> | Iterable<[string, any]>>): this; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment