Upgrading valibot 0.21 to 0.22
Breaking0.21.0 → 0.22.0Breaking1New4Changed1Fixed2
BreakingUpgrade verdict
1 breaking change.
In plain terms
- Rename and change util functions and refactor codebase.
Must act 1 item needs code or config changes
What you must change
Breaking1
Rename and change util functions and refactor codebase.
API changes
Generated by DepDelta from published .d.ts files. Not mixed with prose notes.
- removed:
function executePipe<TValue>(input: TValue, pipe: Pipe<TValue> | undefined, parseInfo: ParseInfo | undefined, reason: IssueReason): _ParseResult<TValue> - removed:
function executePipeAsync<TValue>(input: TValue, pipe: PipeAsync<TValue> | undefined, parseInfo: ParseInfo | undefined, reason: IssueReason): Promise<_ParseResult<TValue>> - removed:
function getDefaultArgs<TPipe extends Pipe<any> | PipeAsync<any>>(arg1: ErrorMessage | TPipe | undefined, arg2: TPipe | undefined): [ErrorMessage | undefined, TPipe | undefined] - removed:
function getIssues<TIssues>(issues: TIssues): { issues: TIssues } - removed:
function getOutput<TOutput>(output: TOutput): { output: TOutput } - removed:
function getPipeIssues(validation: string, message: ErrorMessage, input: unknown, requirement?: unknown): { issues: Pick<Issue, 'validation' | 'message' | 'input' | 'requirement'>[] } - removed:
function getRestAndDefaultArgs<TRest extends BaseSchema | BaseSchemaAsync | undefined, TPipe extends Pipe<any> | PipeAsync<any>>(arg1: TPipe | ErrorMessage | TRest | undefined, arg2: TPipe | ErrorMessage | undefined, arg3: TPipe | undefined): [TRest, ErrorMessage | undefined, TPipe | undefined] - removed:
function getSchemaIssues(info: ParseInfo | undefined, reason: IssueReason, validation: string, message: ErrorMessage, input: unknown, issues?: Issues): { issues: Issues } - removed:
type PipeResult<TOutput> = { output: TOutput; issues?: undefined } | { output?: undefined; issues: Pick<Issue, 'validation' | 'message' | 'input' | 'requirement'>[] } - removed:
type _ParseResult<TOutput> = { output: TOutput; issues?: undefined } | { output?: undefined; issues: Issues } - changed:
function is<TSchema extends BaseSchema>(schema: TSchema, input: unknown): input is Input<TSchema> → function is<TSchema extends BaseSchema>(schema: TSchema, input: unknown, info?: Pick<ParseInfo, 'skipPipe'>): input is Input<TSchema> - changed:
function notValue<TInput extends string | number | bigint, TRequirement extends TInput>(requirement: TRequirement, message?: ErrorMessage): NotValueValidation<TInput, TRequirement> → function notValue<TInput extends string | number | bigint | boolean | Date, TRequirement extends TInput>(requirement: TRequirement, message?: ErrorMessage): NotValueValidation<TInput, TRequirement> - changed:
function nullable<TWrapped extends BaseSchema, const TDefault extends Input<TWrapped> | (() => Input<TWrapped> | undefined) | undefined>(wrapped: TWrapped, default_: TDefault): NullableSchema<TWrapped, TDefault> → function nullable<TWrapped extends BaseSchema, TDefault extends Input<TWrapped> | (() => Input<TWrapped> | undefined) | undefined>(wrapped: TWrapped, default_: TDefault): NullableSchema<TWrapped, TDefault> - changed:
function nullableAsync<TWrapped extends BaseSchema | BaseSchemaAsync, const TDefault extends Input<TWrapped> | (() => Input<TWrapped> | Promise<Input<TWrapped> | undefined> | undefined) | undefined>(wrapped: TWrapped, default_: TDefault): NullableSchemaAsync<TWrapped, TDefault> → function nullableAsync<TWrapped extends BaseSchema | BaseSchemaAsync, TDefault extends Input<TWrapped> | (() => Input<TWrapped> | Promise<Input<TWrapped> | undefined> | undefined) | undefined>(wrapped: TWrapped, default_: TDefault): NullableSchemaAsync<TWrapped, TDefault> - changed:
function nullish<TWrapped extends BaseSchema, const TDefault extends Input<TWrapped> | (() => Input<TWrapped> | undefined) | undefined>(wrapped: TWrapped, default_: TDefault): NullishSchema<TWrapped, TDefault> → function nullish<TWrapped extends BaseSchema, TDefault extends Input<TWrapped> | (() => Input<TWrapped> | undefined) | undefined>(wrapped: TWrapped, default_: TDefault): NullishSchema<TWrapped, TDefault> - changed:
function nullishAsync<TWrapped extends BaseSchema | BaseSchemaAsync, const TDefault extends Input<TWrapped> | (() => Input<TWrapped> | Promise<Input<TWrapped> | undefined> | undefined) | undefined>(wrapped: TWrapped, default_: TDefault): NullishSchemaAsync<TWrapped, TDefault> → function nullishAsync<TWrapped extends BaseSchema | BaseSchemaAsync, TDefault extends Input<TWrapped> | (() => Input<TWrapped> | Promise<Input<TWrapped> | undefined> | undefined) | undefined>(wrapped: TWrapped, default_: TDefault): NullishSchemaAsync<TWrapped, TDefault> - changed:
function optional<TWrapped extends BaseSchema, const TDefault extends Input<TWrapped> | (() => Input<TWrapped> | undefined) | undefined>(wrapped: TWrapped, default_: TDefault): OptionalSchema<TWrapped, TDefault> → function optional<TWrapped extends BaseSchema, TDefault extends Input<TWrapped> | (() => Input<TWrapped> | undefined) | undefined>(wrapped: TWrapped, default_: TDefault): OptionalSchema<TWrapped, TDefault> - changed:
function optionalAsync<TWrapped extends BaseSchema | BaseSchemaAsync, const TDefault extends Input<TWrapped> | (() => Input<TWrapped> | Promise<Input<TWrapped> | undefined> | undefined) | undefined>(wrapped: TWrapped, default_: TDefault): OptionalSchemaAsync<TWrapped, TDefault> → function optionalAsync<TWrapped extends BaseSchema | BaseSchemaAsync, TDefault extends Input<TWrapped> | (() => Input<TWrapped> | Promise<Input<TWrapped> | undefined> | undefined) | undefined>(wrapped: TWrapped, default_: TDefault): OptionalSchemaAsync<TWrapped, TDefault> - changed:
function transform<TSchema extends BaseSchema, TOutput>(schema: TSchema, action: (value: Output<TSchema>) => TOutput, pipe?: Pipe<TOutput>): SchemaWithTransform<TSchema, TOutput> → function transform<TSchema extends BaseSchema, TOutput>(schema: TSchema, action: (value: Output<TSchema>, info: TransformInfo) => TOutput, pipe?: Pipe<TOutput>): SchemaWithTransform<TSchema, TOutput> - changed:
function transform<TSchema extends BaseSchema, TOutput>(schema: TSchema, action: (value: Output<TSchema>) => TOutput, validate?: BaseSchema<TOutput>): SchemaWithTransform<TSchema, TOutput> → function transform<TSchema extends BaseSchema, TOutput>(schema: TSchema, action: (value: Output<TSchema>, info: TransformInfo) => TOutput, validate?: BaseSchema<TOutput>): SchemaWithTransform<TSchema, TOutput> - changed:
function transformAsync<TSchema extends BaseSchema | BaseSchemaAsync, TOutput>(schema: TSchema, action: (value: Output<TSchema>) => TOutput | Promise<TOutput>, pipe?: PipeAsync<TOutput>): SchemaWithTransformAsync<TSchema, TOutput> → function transformAsync<TSchema extends BaseSchema | BaseSchemaAsync, TOutput>(schema: TSchema, action: (value: Output<TSchema>, info: TransformInfo) => TOutput | Promise<TOutput>, pipe?: PipeAsync<TOutput>): SchemaWithTransformAsync<TSchema, TOutput> - changed:
function transformAsync<TSchema extends BaseSchema | BaseSchemaAsync, TOutput>(schema: TSchema, action: (value: Output<TSchema>) => TOutput | Promise<TOutput>, validate?: BaseSchema<TOutput> | BaseSchemaAsync<TOutput>): SchemaWithTransformAsync<TSchema, TOutput> → function transformAsync<TSchema extends BaseSchema | BaseSchemaAsync, TOutput>(schema: TSchema, action: (value: Output<TSchema>, info: TransformInfo) => TOutput | Promise<TOutput>, validate?: BaseSchema<TOutput> | BaseSchemaAsync<TOutput>): SchemaWithTransformAsync<TSchema, TOutput> - changed:
type BaseSchema<TInput = any, TOutput = TInput> = { async: false; _parse(input: unknown, info?: ParseInfo): _ParseResult<TOutput>; _types?: { input: TInput; output: TOutput } } → type BaseSchema<TInput = any, TOutput = TInput> = { async: false; _parse(input: unknown, info?: ParseInfo): SchemaResult<TOutput>; _types?: { input: TInput; output: TOutput } } - changed:
type BaseSchemaAsync<TInput = any, TOutput = TInput> = { async: true; _parse(input: unknown, info?: ParseInfo): Promise<_ParseResult<TOutput>>; _types?: { input: TInput; output: TOutput } } → type BaseSchemaAsync<TInput = any, TOutput = TInput> = { async: true; _parse(input: unknown, info?: ParseInfo): Promise<SchemaResult<TOutput>>; _types?: { input: TInput; output: TOutput } } - changed:
type BaseTransformation<TInput = any> = { async: false; _parse(input: TInput): PipeResult<TInput> } → type BaseTransformation<TInput = any> = { async: false; _parse(input: TInput): PipeActionResult<TInput> } - changed:
type BaseTransformationAsync<TInput = any> = { async: true; _parse(input: TInput): Promise<PipeResult<TInput>> } → type BaseTransformationAsync<TInput = any> = { async: true; _parse(input: TInput): Promise<PipeActionResult<TInput>> } - changed:
type BaseValidation<TInput = any> = { async: false; message: ErrorMessage; _parse(input: TInput): PipeResult<TInput> } → type BaseValidation<TInput = any> = { async: false; message: ErrorMessage; _parse(input: TInput): PipeActionResult<TInput> } - changed:
type BaseValidationAsync<TInput = any> = { async: true; message: ErrorMessage; _parse(input: TInput): Promise<PipeResult<TInput>> } → type BaseValidationAsync<TInput = any> = { async: true; message: ErrorMessage; _parse(input: TInput): Promise<PipeActionResult<TInput>> } - changed:
type NotValueValidation<TInput extends string | number | bigint | Date, TRequirement extends TInput> = BaseValidation<TInput> & { type: 'not_value'; requirement: TRequirement } → type NotValueValidation<TInput extends string | number | bigint | boolean | Date, TRequirement extends TInput> = BaseValidation<TInput> & { type: 'not_value'; requirement: TRequirement } - changed:
type PathItem = ObjectPathItem | RecordPathItem | TuplePathItem | MapPathItem | SetPathItem | ArrayPathItem → type PathItem = ArrayPathItem | MapPathItem | ObjectPathItem | RecordPathItem | SetPathItem | TuplePathItem | UnknownPathItem - changed:
type SafeParseResult<TSchema extends BaseSchema | BaseSchemaAsync> = { success: true; data: Output<TSchema>; output: Output<TSchema> } | { success: false; error: ValiError; issues: Issues } → type SafeParseResult<TSchema extends BaseSchema | BaseSchemaAsync> = { typed: true; success: true; data: Output<TSchema>; output: Output<TSchema>; error: undefined; issues: undefined } | { typed: true; success: false; data: Outp… - changed:
type SchemaWithTransformAsync<TSchema extends BaseSchema | BaseSchemaAsync, TOutput> = Omit<TSchema, 'async' | '_parse' | '_types'> & { async: true; _parse(input: unknown, info?: ParseInfo): Promise<_ParseResult<TOutput>>; _types?: { input: Input… → type SchemaWithTransformAsync<TSchema extends BaseSchema | BaseSchemaAsync, TOutput> = Omit<TSchema, 'async' | '_parse' | '_types'> & { async: true; _parse(input: unknown, info?: ParseInfo): Promise<SchemaResult<TOutput>>; _types?: { input: Input… - added:
function actionIssue(validation: string, message: ErrorMessage, input: unknown, requirement?: unknown, path?: PathItem[]): InvalidActionResult - added:
function actionOutput<TOutput>(output: TOutput): ValidActionResult<TOutput> - added:
function defaultArgs<TPipe extends Pipe<any> | PipeAsync<any>>(arg1: ErrorMessage | TPipe | undefined, arg2: TPipe | undefined): [ErrorMessage | undefined, TPipe | undefined] - added:
function forward<TInput extends unknown[] | Record<string, unknown>>(validation: BaseValidation<TInput>, pathList: PathList<TInput>): BaseValidation<TInput> - added:
function parseResult(typed: false, output: unknown, issues: Issues): UntypedSchemaResult - added:
function parseResult<TOutput>(typed: true, output: TOutput, issues?: Issues): TypedSchemaResult<TOutput> - added:
function pipeResult<TValue>(input: TValue, pipe: Pipe<TValue> | undefined, parseInfo: ParseInfo | undefined, reason: IssueReason, issues?: Issues): SchemaResult<TValue> - added:
function pipeResultAsync<TValue>(input: TValue, pipe: PipeAsync<TValue> | undefined, parseInfo: ParseInfo | undefined, reason: IssueReason, issues?: Issues): Promise<SchemaResult<TValue>> - added:
function restAndDefaultArgs<TRest extends BaseSchema | BaseSchemaAsync | undefined, TPipe extends Pipe<any> | PipeAsync<any>>(arg1: TPipe | ErrorMessage | TRest | undefined, arg2: TPipe | ErrorMessage | undefined, arg3: TPipe | undefined): [TRest, ErrorMessage | undefined, TPipe | undefined] - added:
function schemaIssue(info: ParseInfo | undefined, reason: IssueReason, validation: string, message: ErrorMessage, input: unknown, issues?: Issues): UntypedSchemaResult - added:
type InvalidActionResult = { output?: undefined; issues: Pick<Issue, 'validation' | 'message' | 'input' | 'requirement' | 'path'>[] } - added:
type PipeActionResult<TOutput> = ValidActionResult<TOutput> | InvalidActionResult - added:
type SchemaResult<TOutput> = TypedSchemaResult<TOutput> | UntypedSchemaResult - added:
type TypedSchemaResult<TOutput> = { typed: true; output: TOutput; issues?: Issues } - added:
type UnknownPathItem = { type: 'unknown'; input: unknown; key: unknown; value: unknown } - added:
type UntypedSchemaResult = { typed: false; output: unknown; issues: Issues } - added:
type ValidActionResult<TOutput> = { output: TOutput; issues?: undefined }