chore: make Rehydratable use Awaitable; add docblock
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
* Type representing a JSON serializable object.
|
||||
*/
|
||||
import {ErrorWithContext} from '../error/ErrorWithContext'
|
||||
import {Awaitable} from './types'
|
||||
|
||||
export type JSONState = { [key: string]: string | boolean | number | undefined | JSONState | Array<string | boolean | number | undefined | JSONState> }
|
||||
|
||||
@@ -30,14 +31,14 @@ export function isJSONState(what: unknown): what is JSONState {
|
||||
export interface Rehydratable {
|
||||
/**
|
||||
* Dehydrate this class' state and get it.
|
||||
* @return Promise<JSONState>
|
||||
* @return JSONState|Promise<JSONState>
|
||||
*/
|
||||
dehydrate(): Promise<JSONState>
|
||||
dehydrate(): Awaitable<JSONState>
|
||||
|
||||
/**
|
||||
* Rehydrate a state into this class.
|
||||
* @param {JSONState} state
|
||||
* @return void|Promise<void>
|
||||
*/
|
||||
rehydrate(state: JSONState): void | Promise<void>
|
||||
rehydrate(state: JSONState): Awaitable<void>
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user