You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
421 B

export type JSONState = { [key: string]: string | boolean | number | JSONState | Array<string | boolean | number | JSONState> }
export function isJSONState(what: any): what is JSONState {
try {
JSON.stringify(what)
return true
} catch (e) {
return false
}
}
export interface Rehydratable {
dehydrate(): Promise<JSONState>
rehydrate(state: JSONState): void | Promise<void>
}