Skip to main content

swappedNullishOr()

swappedNullishOr<A>(a): <B>(b) => A | NonNullable<B>

Swapped Nullish Coalescing (b ?? a).

Type Parameters

A

A

The type of the first input value.

Parameters

a

A

The value to fallback to.

Returns

<B>(b): A | NonNullable<B>

Type Parameters

B

B

Parameters

b

B

Returns

A | NonNullable<B>

Remark

pure function

Example

swappedNullishOr(4)(null);
// 4