Kit
Functions

isStringifiedBigInt

isStringifiedBigInt(putativeBigInt): putativeBigInt is StringifiedBigInt

A type guard that returns true if the input string parses as a BigInt, and refines its type for use in your program.

Parameters

ParameterType
putativeBigIntstring

Returns

putativeBigInt is StringifiedBigInt

Example

import { isStringifiedBigInt } from '@solana/rpc-types';
 
if (isStringifiedBigInt(bigintString)) {
    // At this point, `bigintString` has been refined to a `StringifiedBigInt`
    bigintString satisfies StringifiedBigInt; // OK
} else {
    setError(`${bigintString} does not represent a BigInt`);
}

On this page