export type Identity = T extends object ? {} & { [P in keyof T as T[P] extends never ? never : P]: T[P]; } : T; type IsEmptyObject = T extends Record ? (keyof T extends never ? true : false) : false; export type LastInArray = T extends [...any[], infer Last] ? Last : TFallback; export type MaybePromise = T | Promise; export type AnyFunction = (...args: any[]) => TReturn; type OnlyRequiredProperties = { [K in keyof T as Extract extends never ? K : never]: T[K]; }; export type AllPropertiesAreOptional = Record extends T ? true : IsEmptyObject>; /** * Converts a type to a string if it is a string, otherwise returns never. * Specifically useful when using keyof T to produce a union of strings * rather than string | number | symbol. */ export type AsString = T extends string ? T : never; export {};