From 7aa1404d9bd8202b5406be7022e6c25a86084389 Mon Sep 17 00:00:00 2001 From: Per-Kristian Nordnes Date: Tue, 6 Dec 2022 01:31:31 +0100 Subject: [PATCH] refactor(types): remove deprecated block validator Rules from v2 --- .../@sanity/types/src/validation/types.ts | 23 +------------------ 1 file changed, 1 insertion(+), 22 deletions(-) diff --git a/packages/@sanity/types/src/validation/types.ts b/packages/@sanity/types/src/validation/types.ts index 34fc5544a22..d82642dfab6 100644 --- a/packages/@sanity/types/src/validation/types.ts +++ b/packages/@sanity/types/src/validation/types.ts @@ -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' @@ -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 @@ -342,23 +338,6 @@ export type CustomValidator = ( context: ValidationContext ) => CustomValidatorResult | Promise -/** - * @deprecated use `Rule.custom` instead - * - * @see CustomValidator - * - * @public - */ -export type BlockValidator = ( - block: Block, - options: ValidationContext -) => - | ValidationError[] - | ValidationError - | string - | true - | Promise - /** @public */ export interface SlugValidationContext extends ValidationContext { parent: SlugParent