Type alias MaybeRequired<T, TRequired>

MaybeRequired<T, TRequired>: TRequired extends true
    ? Required<T>
    : T

Type Parameters

  • T

  • TRequired extends boolean

Description

Makes attributes on the type T required if TRequired is true.

Example

MaybeRequired<{ a: string, b?: number }, true>
=> { a: string, b: number }

MaybeRequired<{ a: string, b?: number }, false>
=> { a: string, b?: number }

Generated using TypeDoc