swappedNullishOr()
swappedNullishOr<
A
>(a
): <B
>(b
) =>A
|NonNullable
<B
>
Swapped Nullish Coalescing: (b ?? a)
.
Type Parameters
• A
Parameters
a
A
The value to fallback to.
Returns
Function
Type Parameters
• B
Parameters
b
B
Returns
A
| NonNullable
<B
>
Remark
pure function
Example
swappedNullishOr(4)(null);
// 4