type Fn = (...arg: any[]) => any export type MaybePromise = T | Promise export type RequiredDeep< Type, U extends Record | Fn | undefined = undefined, > = Type extends Fn ? Type : /** * @note The "Fn" type satisfies the predicate below. * It must always come first, before the Record check. */ Type extends Record ? { [Key in keyof Type]-?: NonNullable extends NonNullable ? NonNullable : RequiredDeep, U> } : Type /** * @fixme Remove this once TS 5.4 is the lowest supported version. * Because "NoInfer" is a built-in type utility there. */ export type NoInfer = [T][T extends any ? 0 : never]