/** * Makes all properties of type `T` optional except for those in `K`. */ export type OptionalExcept, K extends keyof T> = Pick & Partial>; /** * Makes all properties of type `T` required except for those in `K`. */ export type RequiredExcept, K extends keyof T> = Pick> & Required>; /** * Extracts keys from a type `T` the values of which are type `V`. */ export type ExtractKeysOfValueType = { [K in keyof T]-?: T[K] extends V ? K : never; }[keyof T]; /** * Given a function `T`, returns a function type with the same parameters, but * with the return type `Promise | R` where `R` is the return type of `T`. */ export type MaybeAsync any> = (...args: Parameters) => Promise> | ReturnType; export type { PublicOnly, PublicOnlyIfObject } from '../../shared/types.js'; /** * Given a type `T`, returns a type with only the public properties of `T` and * its descendants. */ export type PublicOnlyDeep = { [K in keyof T]: T[K] extends Function ? T[K] : T[K] extends object ? PublicOnlyDeep : T[K]; };