Skip to content

Latest commit

History

History
30 lines (23 loc) 路 595 Bytes

readme.md

File metadata and controls

30 lines (23 loc) 路 595 Bytes

bigint

Back to root readme.md

This function uses the rulr.isBigInt guard to check the input is a bigint as shown in the example below. It should only throw rulr.InvalidBigIntError.

import * as rulr from 'rulr'

const constrainToExample = rulr.object({
	required: {
		example: rulr.bigint,
	},
})

type Example = rulr.Static<typeof constrainToExample>
// {
//   example: bigint
// }

// Valid
const example1: Example = constrainToExample({
	example: BigInt(9007199254740991),
})

// Invalid
const example2: Example = constrainToExample({
	example: 10,
})