/** * @description A debug type that will provide an expanded type description when * reviewing complex types with a lot of inheritance and/or intersections * @private * Example: type A = { foo: string } function bar(newObject: PropertiesOf) {...} bar({ foo: 'baz' }) // valid bar({ otherProp: 'stuff' }) // invalid */ export type Prettify = { [K in keyof T]: T[K]; }; /** * @description Infers a union type from the values of an object, useful for enum-like consts * @private * Example: const Obj = { FOO: "foo", BAR: "bar", BAZ: [] } export type Values = StringValueOf; // "foo" | "bar" */ export type StringValueOf = { [K in keyof T]: T[K] extends string ? T[K] : never; }[keyof T]; /** * @description Recursively applies Partial to a type * @private */ export type DeepPartial = Thing extends Function ? Thing : Thing extends Array ? DeepPartialArray : Thing extends object ? DeepPartialObject : Thing | undefined; interface DeepPartialArray extends Array> { } type DeepPartialObject = { [Key in keyof Thing]?: DeepPartial; }; export {};