downtimer
Version:
Timeouts, but a little more relaxing
18 lines (17 loc) • 517 B
TypeScript
export type DeepPartial<T> = T extends object ? {
[P in keyof T]?: DeepPartial<T[P]>;
} : T;
/**
* A unique ID representing a timer.
*
* Under the hood, this is just a `string`, and so can technically be JSON serialized, but
* saving it to a file doesn't make very much sense, since the timers will all be killed when the
* process exits.
*/
export type TimerId = string & {
__timerId: '__timerId';
};
/**
* A callback function, executed once a timer fires.
*/
export type TimerCallback = () => void;