Skip to content

Latest commit

 

History

History
24 lines (18 loc) · 690 Bytes

readme.md

File metadata and controls

24 lines (18 loc) · 690 Bytes

unknown

Back to root readme.md

This function can be used when you don't need to validate part of an input as shown in the example below. This may be because you will validate it later or because you don't need to use the input. If you don't need to use the input, but don't want to validate it, you might consider using the any rule. It should never throw an error.

import * as rulr from 'rulr'

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

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

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