@sanity/validation
Version:
Validation and warning infrastructure for Sanity projects
17 lines (12 loc) • 356 B
text/typescript
import {Validators} from '@sanity/types'
import genericValidator from './genericValidator'
const booleanValidators: Validators = {
...genericValidator,
presence: (flag, value, message) => {
if (flag === 'required' && typeof value !== 'boolean') {
return message || 'Required'
}
return true
},
}
export default booleanValidators