balena-supervisor/typings/global.d.ts
Cameron Diver 5a95613dd7
Add UnwrappedPromise and DeepPartial types
Signed-off-by: Cameron Diver <cameron@balena.io>
2020-02-25 14:50:19 +07:00

15 lines
331 B
TypeScript

interface Dictionary<T> {
[key: string]: T;
}
type Callback<T> = (err?: Error, res?: T) => void;
type Nullable<T> = T | null | undefined;
type Resolvable<T> = T | Promise<T>;
type UnwrappedPromise = T extends PromiseLike<infer U> ? U : T;
type DeepPartial<T> = T extends object
? { [K in keyof T]?: DeepPartial<T[K]> }
: T;