/* eslint-disable @typescript-eslint/array-type */ export type FunctionPropertyNames = { [K in keyof T]: T[K] extends Function ? K : never }[keyof T] export type FunctionProperties = Pick> export type AttributesOnly = { [K in keyof T]: T[K] extends Function ? never : T[K] } export type PickWith = { [P in KT]: T[P] extends V ? V : never } export type PickWithOpt = { [P in KT]?: T[P] extends V ? V : never } // https://github.com/krzkaczor/ts-essentials Rocks! export type DeepPartial = { [P in keyof T]?: T[P] extends Array ? Array> : T[P] extends ReadonlyArray ? ReadonlyArray> : DeepPartial } type Primitive = string | Function | number | boolean | symbol | undefined | null export type DeepOmitHelper = { [P in K]: // extra level of indirection needed to trigger homomorhic behavior T[P] extends infer TP // distribute over unions ? TP extends Primitive ? TP // leave primitives and functions alone : TP extends any[] ? DeepOmitArray // Array special handling : DeepOmit : never } export type DeepOmit = T extends Primitive ? T : DeepOmitHelper> export type DeepOmitArray = { [P in keyof T]: DeepOmit } export type Unpacked = T extends (infer U)[] ? U : T export type Awaitable = T | PromiseLike