diff --git a/src/types/global.d.ts b/src/types/global.d.ts new file mode 100644 index 0000000..4a3191a --- /dev/null +++ b/src/types/global.d.ts @@ -0,0 +1,24 @@ +export {}; + +declare global { + /** + * Allows extracting all possible values of another type. + */ + type ValueOf = T[keyof T]; + + /** + * Like Partial utility type, only this allows specifying select keys + * to be made optional instead of all keys. + */ + type Optional = Partial> & Omit + + /** + * A slightly nicer way of defining nullable types. + */ + type Nullable = T | null; + + /** + * Replace the type for specified keys of a type. + */ + type Replace = Omit & { [key in K]: R }; +}