Skip to main content Link Menu Expand (external link) Document Search Copy Copied

BigIntFromString overview

Added in v0.5.11


Table of contents


BigIntFromStringC (interface)

Signature

export interface BigIntFromStringC extends t.Type<bigint, string, unknown> {}

Added in v0.5.11

BigIntFromString

Signature

export const BigIntFromString: BigIntFromStringC = ...

Example

import { BigIntFromString } from 'io-ts-types/lib/BigIntFromString'
import { right } from 'fp-ts/lib/Either'
import { PathReporter } from 'io-ts/lib/PathReporter'

assert.deepStrictEqual(BigIntFromString.decode('1'), right(BigInt(1)))
assert.deepStrictEqual(PathReporter.report(BigIntFromString.decode('1.1')), [
  'Invalid value "1.1" supplied to : BigIntFromString'
])
assert.deepStrictEqual(PathReporter.report(BigIntFromString.decode('')), [
  'Invalid value "" supplied to : BigIntFromString'
])
assert.deepStrictEqual(PathReporter.report(BigIntFromString.decode(' ')), [
  'Invalid value " " supplied to : BigIntFromString'
])

Added in v0.5.11