Skip to content

Commit

Permalink
refactor(types): remove deprecated block validator Rules from v2
Browse files Browse the repository at this point in the history
  • Loading branch information
skogsmaskin committed Dec 20, 2022
1 parent 48c03a9 commit 7aa1404
Showing 1 changed file with 1 addition and 22 deletions.
23 changes: 1 addition & 22 deletions packages/@sanity/types/src/validation/types.ts
Expand Up @@ -3,9 +3,9 @@ import type {Path} from '../paths'
import type {Schema, SchemaType, SchemaValidationValue} from '../schema'
import type {SanityDocument} from '../documents'
import type {ValidationMarker} from '../markers'
import type {Block} from '../portableText'
import {SlugSchemaType} from '../schema'
import {SlugParent} from '../slug'
import {PortableTextBlock} from '../portableText'

/** @public */
export type RuleTypeConstraint = 'Array' | 'Boolean' | 'Date' | 'Number' | 'Object' | 'String'
Expand Down Expand Up @@ -159,10 +159,6 @@ export interface Rule {
uri(options?: UriValidationOptions): Rule
unique(): Rule
reference(): Rule
/**
* @deprecated use `Rule.custom` instead
*/
block(blockValidators: BlockValidator): Rule
fields(rules: FieldRules): Rule
assetRequired(): Rule
validate(value: unknown, options: ValidationContext): Promise<ValidationMarker[]>
Expand Down Expand Up @@ -342,23 +338,6 @@ export type CustomValidator<T = unknown> = (
context: ValidationContext
) => CustomValidatorResult | Promise<CustomValidatorResult>

/**
* @deprecated use `Rule.custom` instead
*
* @see CustomValidator
*
* @public
*/
export type BlockValidator = (
block: Block,
options: ValidationContext
) =>
| ValidationError[]
| ValidationError
| string
| true
| Promise<ValidationError[] | ValidationError | string | true>

/** @public */
export interface SlugValidationContext extends ValidationContext {
parent: SlugParent
Expand Down

0 comments on commit 7aa1404

Please sign in to comment.