Type Alias Box<T, Options>

Box<T, Options>: IsFunction<T, IsFunction.$Branch> extends infer R
    ? R extends $Then
        ? Function
        : IsObject<T, IsObject.$Branch<{
                exact: true;
            }>> extends infer R
            ? R extends $Then
                ? Object
                : T extends Record<any, any>
                    ? T
                    : IsBoolean<T, $SelectionBranch> extends infer R
                        ? R extends $Then
                            ? Boolean
                            : R extends $Else
                                ? IsNumber<T, NumberPlus.IsNumber.$Branch> extends infer R
                                    ? R extends $Then
                                        ? Number
                                        : (...) extends (...)
                                            ? (...)
                                            : (...)
                                    : never
                                : never
                        : never
            : never
    : never

⚗️ transform 🔢 customizable

Converts primitive types to their boxed types.

Type Parameters

return type when T is not boxable. Defaults to never.

Box<number> // Number
Box<object> // Object
Box<string> // String
Box<'abc'> // String

Box<undefined> // never