isDecimalFixedPoint

function isDecimalFixedPoint<TSignedness, TTotalBits, TDecimals>(
    value,
    signedness?,
    totalBits?,
    decimals?,
): value is DecimalFixedPoint<TSignedness, TTotalBits, TDecimals>;

Type guard that refines an unknown value to a DecimalFixedPoint.

Accepts the same partial-positional shape arguments as assertIsDecimalFixedPoint and returns true if the assertion would pass, false otherwise.

Type Parameters

Type ParameterDefault type
TSignedness extends SignednessSignedness
TTotalBits extends numbernumber
TDecimals extends numbernumber

Parameters

ParameterType
valueunknown
signedness?TSignedness
totalBits?TTotalBits
decimals?TDecimals

Returns

value is DecimalFixedPoint<TSignedness, TTotalBits, TDecimals>

Example

if (isDecimalFixedPoint(value)) {
    value satisfies DecimalFixedPoint<Signedness, number, number>;
}
if (isDecimalFixedPoint(value, 'unsigned', 64, 6)) {
    value satisfies DecimalFixedPoint<'unsigned', 64, 6>;
}

See

On this page