devtypes - v1.1.0
    Preparing search index...

    Type Alias If<Cond, Then, Else>

    If: Cond extends true ? Then : Else

    Conditional type helper.

    Type Parameters

    • Cond extends boolean

      Boolean condition to evaluate

    • Then

      Type returned if the condition is true

    • Else = never

      Type returned if the condition is false (defaults to never)

    Evaluates a boolean condition at the type level and resolves to one of two branches. Commonly used as a building block for more complex utilities.

    type Result = If< true, string, number >;
    // string