Add UnwrappedPromise and DeepPartial types

Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
Cameron Diver 2019-12-18 15:52:42 +00:00
parent adf6d427fc
commit 5a95613dd7
No known key found for this signature in database
GPG Key ID: 49690ED87032539F

6
typings/global.d.ts vendored
View File

@ -6,3 +6,9 @@ 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;