import { Get } from 'type-fest'; declare type Maybe = T | null | undefined; declare type Preserve = T extends U ? U : never; declare type Optionals = Extract; declare type Defined = T extends undefined ? never : T; declare type NotNull = T extends null ? never : T; declare type Thunk = T | (() => T); declare type _ = T extends {} ? { [k in keyof T]: T[k]; } : T; declare type Flags = 's' | 'd' | ''; declare type SetFlag = Exclude | F; declare type UnsetFlag = Exclude extends never ? '' : Exclude; declare type ToggleDefault = Preserve extends never ? SetFlag : UnsetFlag; declare type ResolveFlags = Preserve extends never ? Extract extends never ? T : D extends undefined ? T : Defined : never; declare type Concat = NonNullable & NonNullable extends never ? never : (NonNullable & NonNullable) | Optionals; declare type Params = Record; declare class ValidationError extends Error { value: any; path?: string; type?: string; errors: string[]; params?: Params; inner: ValidationError[]; static formatError(message: string | ((params: Params) => string) | unknown, params: Params): any; static isError(err: any): err is ValidationError; constructor(errorOrErrors: string | ValidationError | readonly ValidationError[], value?: any, field?: string, type?: string); } declare type PanicCallback = (err: Error) => void; declare type NextCallback = (err: ValidationError[] | ValidationError | null) => void; declare type CreateErrorOptions = { path?: string; message?: Message; params?: ExtraParams; type?: string; }; declare type TestContext = { path: string; options: ValidateOptions; originalValue: any; parent: any; from?: Array<{ schema: ISchema; value: any; }>; schema: any; resolve: (value: T | Reference) => T; createError: (params?: CreateErrorOptions) => ValidationError; }; declare type TestFunction = (this: TestContext, value: T, context: TestContext) => void | boolean | ValidationError | Promise; declare type TestOptions = { value: any; path?: string; options: InternalOptions; originalValue: any; schema: TSchema; }; declare type TestConfig = { name?: string; message?: Message; test: TestFunction; params?: ExtraParams; exclusive?: boolean; skipAbsent?: boolean; }; declare type Test = ((opts: TestOptions, panic: PanicCallback, next: NextCallback) => void) & { OPTIONS?: TestConfig; }; declare class ReferenceSet extends Set { describe(): unknown[]; resolveAll(resolve: (v: unknown | Reference) => unknown): unknown[]; clone(): ReferenceSet; merge(newItems: ReferenceSet, removeItems: ReferenceSet): ReferenceSet; } declare type SchemaSpec = { coerce: boolean; nullable: boolean; optional: boolean; default?: TDefault | (() => TDefault); abortEarly?: boolean; strip?: boolean; strict?: boolean; recursive?: boolean; label?: string | undefined; meta?: any; }; declare type SchemaOptions = { type: string; spec?: Partial>; check: (value: any) => value is NonNullable; }; declare type AnySchema = Schema; interface CastOptions$1 { parent?: any; context?: C; assert?: boolean; stripUnknown?: boolean; path?: string; resolved?: boolean; } interface CastOptionalityOptions extends Omit, 'assert'> { /** * Whether or not to throw TypeErrors if casting fails to produce a valid type. * defaults to `true`. The `'ignore-optionality'` options is provided as a migration * path from pre-v1 where `schema.nullable().required()` was allowed. When provided * cast will only throw for values that are the wrong type *not* including `null` and `undefined` */ assert: 'ignore-optionality'; } declare type RunTest = (opts: TestOptions, panic: PanicCallback, next: NextCallback) => void; declare type TestRunOptions = { tests: RunTest[]; path?: string | undefined; options: InternalOptions; originalValue: any; value: any; }; interface SchemaRefDescription { type: 'ref'; key: string; } interface SchemaInnerTypeDescription extends SchemaDescription { innerType?: SchemaFieldDescription; } interface SchemaObjectDescription extends SchemaDescription { fields: Record; } interface SchemaLazyDescription { type: string; label?: string; meta: object | undefined; } declare type SchemaFieldDescription = SchemaDescription | SchemaRefDescription | SchemaObjectDescription | SchemaInnerTypeDescription | SchemaLazyDescription; interface SchemaDescription { type: string; label?: string; meta: object | undefined; oneOf: unknown[]; notOneOf: unknown[]; nullable: boolean; optional: boolean; tests: Array<{ name?: string; params: ExtraParams | undefined; }>; } declare abstract class Schema implements ISchema { readonly type: string; readonly __outputType: ResolveFlags; readonly __context: TContext; readonly __flags: TFlags; readonly __isYupSchema__: boolean; readonly __default: TDefault; readonly deps: readonly string[]; tests: Test[]; transforms: TransformFunction[]; private conditions; private _mutate?; private internalTests; protected _whitelist: ReferenceSet; protected _blacklist: ReferenceSet; protected exclusiveTests: Record; protected _typeCheck: (value: any) => value is NonNullable; spec: SchemaSpec; constructor(options: SchemaOptions); get _type(): string; clone(spec?: Partial>): this; label(label: string): this; meta(): Record | undefined; meta(obj: Record): this; withMutation(fn: (schema: this) => T): T; concat(schema: this): this; concat(schema: AnySchema): AnySchema; isType(v: unknown): v is TType; resolve(options: ResolveOptions): this; protected resolveOptions>(options: T): T; /** * Run the configured transform pipeline over an input value. */ cast(value: any, options?: CastOptions$1): this['__outputType']; cast(value: any, options: CastOptionalityOptions): this['__outputType'] | null | undefined; protected _cast(rawValue: any, _options: CastOptions$1): any; protected _validate(_value: any, options: InternalOptions | undefined, panic: (err: Error, value: unknown) => void, next: (err: ValidationError[], value: unknown) => void): void; /** * Executes a set of validations, either schema, produced Tests or a nested * schema validate result. */ protected runTests(runOptions: TestRunOptions, panic: (err: Error, value: unknown) => void, next: (errors: ValidationError[], value: unknown) => void): void; asNestedTest({ key, index, parent, parentPath, originalParent, options, }: NestedTestConfig): RunTest; validate(value: any, options?: ValidateOptions): Promise; validateSync(value: any, options?: ValidateOptions): this['__outputType']; isValid(value: any, options?: ValidateOptions): Promise; isValidSync(value: any, options?: ValidateOptions): value is this['__outputType']; protected _getDefault(): any; getDefault(options?: ResolveOptions): TDefault; default(def: Thunk): any; strict(isStrict?: boolean): this; protected nullability(nullable: boolean, message?: Message): this; protected optionality(optional: boolean, message?: Message): this; optional(): any; defined(message?: Message): any; nullable(): any; nonNullable(message?: Message): any; required(message?: Message): any; notRequired(): any; transform(fn: TransformFunction): this; /** * Adds a test function to the schema's queue of tests. * tests can be exclusive or non-exclusive. * * - exclusive tests, will replace any existing tests of the same name. * - non-exclusive: can be stacked * * If a non-exclusive test is added to a schema with an exclusive test of the same name * the exclusive test is removed and further tests of the same name will be stacked. * * If an exclusive test is added to a schema with non-exclusive tests of the same name * the previous tests are removed and further tests of the same name will replace each other. */ test(options: TestConfig): this; test(test: TestFunction): this; test(name: string, test: TestFunction): this; test(name: string, message: Message, test: TestFunction): this; when = this>(builder: ConditionBuilder): U; when = this>(keys: string | string[], builder: ConditionBuilder): U; when = this, UOtherwise extends ISchema = this>(options: ConditionConfig): UThen | UOtherwise; when = this, UOtherwise extends ISchema = this>(keys: string | string[], options: ConditionConfig): UThen | UOtherwise; typeError(message: Message): this; oneOf(enums: ReadonlyArray, message?: Message<{ values: any; }>): this; oneOf(enums: ReadonlyArray, message: Message<{ values: any; }>): any; notOneOf(enums: ReadonlyArray | Reference>, message?: Message<{ values: any; }>): this; strip(strip?: boolean): any; /** * Return a serialized description of the schema including validations, flags, types etc. * * @param options Provide any needed context for resolving runtime schema alterations (lazy, when conditions, etc). */ describe(options?: ResolveOptions): SchemaDescription; } interface Schema { validateAt(path: string, value: any, options?: ValidateOptions): Promise; validateSyncAt(path: string, value: any, options?: ValidateOptions): any; equals: Schema['oneOf']; is: Schema['oneOf']; not: Schema['notOneOf']; nope: Schema['notOneOf']; } declare type ReferenceOptions = { map?: (value: unknown) => TValue; }; declare function create$9(key: string, options?: ReferenceOptions): Reference; declare class Reference { readonly key: string; readonly isContext: boolean; readonly isValue: boolean; readonly isSibling: boolean; readonly path: any; readonly getter: (data: unknown) => unknown; readonly map?: (value: unknown) => TValue; readonly __isYupRef: boolean; constructor(key: string, options?: ReferenceOptions); getValue(value: any, parent?: {}, context?: {}): TValue; /** * * @param {*} value * @param {Object} options * @param {Object=} options.context * @param {Object=} options.parent */ cast(value: any, options?: { parent?: {}; context?: {}; }): TValue; resolve(): this; describe(): SchemaRefDescription; toString(): string; static isRef(value: any): value is Reference; } declare type ConditionBuilder, U extends ISchema = T> = (values: any[], schema: T, options: ResolveOptions) => U; declare type ConditionConfig, TThen extends ISchema = T, TOtherwise extends ISchema = T> = { is: any | ((...values: any[]) => boolean); then?: (schema: T) => TThen; otherwise?: (schema: T) => TOtherwise; }; declare type ResolveOptions = { value?: any; parent?: any; context?: TContext; }; declare type ObjectShape = { [k: string]: ISchema | Reference; }; declare type AnyObject = { [k: string]: any; }; declare type TypeFromShape = { [K in keyof S]: S[K] extends ISchema ? S[K]['__outputType'] : S[K] extends Reference ? T : unknown; }; declare type DefaultFromShape = { [K in keyof Shape]: Shape[K] extends ISchema ? Shape[K]['__default'] : undefined; }; declare type ConcatObjectTypes, U extends Maybe> = ({ [P in keyof T]: P extends keyof NonNullable ? NonNullable[P] : T[P]; } & U) | Optionals; declare type PartialDeep = T extends string | number | bigint | boolean | null | undefined | symbol | Date ? T | undefined : T extends Array ? Array> : T extends ReadonlyArray ? ReadonlyArray : { [K in keyof T]?: PartialDeep; }; declare type OptionalKeys = { [k in keyof T]: undefined extends T[k] ? k : never; }[keyof T]; declare type RequiredKeys = Exclude>; declare type MakePartial = { [k in OptionalKeys as T[k] extends never ? never : k]?: T[k]; } & { [k in RequiredKeys as T[k] extends never ? never : k]: T[k]; }; interface ISchema { __flags: F; __context: C; __outputType: T; __default: D; cast(value: any, options?: CastOptions$1): T; cast(value: any, options: CastOptionalityOptions): T | null | undefined; validate(value: any, options?: ValidateOptions): Promise; asNestedTest(config: NestedTestConfig): Test; describe(options?: ResolveOptions): SchemaFieldDescription; resolve(options: ResolveOptions): ISchema; } declare type InferType> = T['__outputType']; declare type TransformFunction = (this: T, value: any, originalValue: any, schema: T) => any; interface Ancester { schema: ISchema; value: any; } interface ValidateOptions { /** * Only validate the input, skipping type casting and transformation. Default - false */ strict?: boolean; /** * Return from validation methods on the first error rather than after all validations run. Default - true */ abortEarly?: boolean; /** * Remove unspecified keys from objects. Default - false */ stripUnknown?: boolean; /** * When false validations will not descend into nested schema (relevant for objects or arrays). Default - true */ recursive?: boolean; /** * Any context needed for validating schema conditions (see: when()) */ context?: TContext; } interface InternalOptions extends ValidateOptions { __validating?: boolean; originalValue?: any; index?: number; key?: string; parent?: any; path?: string; sync?: boolean; from?: Ancester[]; } interface MessageParams { path: string; value: any; originalValue: any; label: string; type: string; spec: SchemaSpec & Record; } declare type Message = any> = string | ((params: Extra & MessageParams) => unknown) | Record; declare type ExtraParams = Record; interface NestedTestConfig { options: InternalOptions; parent: any; originalParent: any; parentPath: string | undefined; key?: string; index?: number; } declare type AnyPresentValue = {}; declare type TypeGuard = (value: any) => value is NonNullable; interface MixedOptions { type?: string; check?: TypeGuard; } declare function create$8(spec?: MixedOptions | TypeGuard): MixedSchema; declare namespace create$8 { var prototype: MixedSchema; } declare class MixedSchema = AnyPresentValue | undefined, TContext = AnyObject, TDefault = undefined, TFlags extends Flags = ''> extends Schema { constructor(spec?: MixedOptions | TypeGuard); } interface MixedSchema = AnyPresentValue | undefined, TContext = AnyObject, TDefault = undefined, TFlags extends Flags = ''> extends Schema { default>(def: Thunk): MixedSchema>; concat(schema: MixedSchema): MixedSchema, TContext & IC, ID, TFlags | IF>; concat(schema: Schema): MixedSchema, TContext & IC, ID, TFlags | IF>; concat(schema: this): this; defined(msg?: Message): MixedSchema, TContext, TDefault, TFlags>; optional(): MixedSchema; required(msg?: Message): MixedSchema, TContext, TDefault, TFlags>; notRequired(): MixedSchema, TContext, TDefault, TFlags>; nullable(msg?: Message): MixedSchema; nonNullable(): MixedSchema, TContext, TDefault, TFlags>; strip(enabled: false): MixedSchema>; strip(enabled?: true): MixedSchema>; } declare function create$7(): BooleanSchema; declare function create$7 = AnyObject>(): BooleanSchema; declare namespace create$7 { var prototype: BooleanSchema; } declare class BooleanSchema = boolean | undefined, TContext = AnyObject, TDefault = undefined, TFlags extends Flags = ''> extends Schema { constructor(); isTrue(message?: Message | undefined): BooleanSchema, TContext, TFlags>; isFalse(message?: Message | undefined): BooleanSchema, TContext, TFlags>; default>(def: Thunk): BooleanSchema>; defined(msg?: Message): BooleanSchema, TContext, TDefault, TFlags>; optional(): BooleanSchema; required(msg?: Message): BooleanSchema, TContext, TDefault, TFlags>; notRequired(): BooleanSchema, TContext, TDefault, TFlags>; nullable(): BooleanSchema; nonNullable(msg?: Message): BooleanSchema, TContext, TDefault, TFlags>; strip(enabled: false): BooleanSchema>; strip(enabled?: true): BooleanSchema>; } interface MixedLocale { default?: Message; required?: Message; oneOf?: Message<{ values: any; }>; notOneOf?: Message<{ values: any; }>; notNull?: Message; notType?: Message; defined?: Message; } interface StringLocale { length?: Message<{ length: number; }>; min?: Message<{ min: number; }>; max?: Message<{ max: number; }>; matches?: Message<{ regex: RegExp; }>; email?: Message<{ regex: RegExp; }>; url?: Message<{ regex: RegExp; }>; uuid?: Message<{ regex: RegExp; }>; trim?: Message; lowercase?: Message; uppercase?: Message; } interface NumberLocale { min?: Message<{ min: number; }>; max?: Message<{ max: number; }>; lessThan?: Message<{ less: number; }>; moreThan?: Message<{ more: number; }>; positive?: Message<{ more: number; }>; negative?: Message<{ less: number; }>; integer?: Message; } interface DateLocale { min?: Message<{ min: Date | string; }>; max?: Message<{ max: Date | string; }>; } interface ObjectLocale { noUnknown?: Message; } interface ArrayLocale { length?: Message<{ length: number; }>; min?: Message<{ min: number; }>; max?: Message<{ max: number; }>; } interface BooleanLocale { isValue?: Message; } interface LocaleObject { mixed?: MixedLocale; string?: StringLocale; number?: NumberLocale; date?: DateLocale; boolean?: BooleanLocale; object?: ObjectLocale; array?: ArrayLocale; } declare type MatchOptions = { excludeEmptyString?: boolean; message: Message<{ regex: RegExp; }>; name?: string; }; declare function create$6(): StringSchema; declare function create$6 = AnyObject>(): StringSchema; declare namespace create$6 { var prototype: StringSchema; } declare class StringSchema = string | undefined, TContext = AnyObject, TDefault = undefined, TFlags extends Flags = ''> extends Schema { constructor(); length(length: number | Reference, message?: Message<{ length: number; }>): this; min(min: number | Reference, message?: Message<{ min: number; }>): this; max(max: number | Reference, message?: Message<{ max: number; }>): this; matches(regex: RegExp, options?: MatchOptions | MatchOptions['message']): this; email(message?: Message<{ regex: RegExp; }>): this; url(message?: Message<{ regex: RegExp; }>): this; uuid(message?: Message<{ regex: RegExp; }>): this; ensure(): StringSchema>; trim(message?: Message): this; lowercase(message?: Message): this; uppercase(message?: Message): this; } interface StringSchema = string | undefined, TContext = AnyObject, TDefault = undefined, TFlags extends Flags = ''> extends Schema { default>(def: Thunk): StringSchema>; oneOf(arrayOfValues: ReadonlyArray>, message?: MixedLocale['oneOf']): StringSchema, TContext, TDefault, TFlags>; oneOf(enums: ReadonlyArray, message?: Message<{ values: any; }>): this; concat, UContext, UDefault, UFlags extends Flags>(schema: StringSchema): StringSchema, TContext & UContext, UDefault, TFlags | UFlags>; concat(schema: this): this; defined(msg?: Message): StringSchema, TContext, TDefault, TFlags>; optional(): StringSchema; required(msg?: Message): StringSchema, TContext, TDefault, TFlags>; notRequired(): StringSchema, TContext, TDefault, TFlags>; nullable(msg?: Message): StringSchema; nonNullable(): StringSchema, TContext, TDefault, TFlags>; strip(enabled: false): StringSchema>; strip(enabled?: true): StringSchema>; } declare function create$5(): NumberSchema; declare function create$5 = AnyObject>(): NumberSchema; declare namespace create$5 { var prototype: NumberSchema; } declare class NumberSchema = number | undefined, TContext = AnyObject, TDefault = undefined, TFlags extends Flags = ''> extends Schema { constructor(); min(min: number | Reference, message?: Message<{ min: number; }>): this; max(max: number | Reference, message?: Message<{ max: number; }>): this; lessThan(less: number | Reference, message?: Message<{ less: number; }>): this; moreThan(more: number | Reference, message?: Message<{ more: number; }>): this; positive(msg?: Message<{ more: number; }>): this; negative(msg?: Message<{ less: number; }>): this; integer(message?: Message): this; truncate(): this; round(method?: 'ceil' | 'floor' | 'round' | 'trunc'): this; } interface NumberSchema = number | undefined, TContext = AnyObject, TDefault = undefined, TFlags extends Flags = ''> extends Schema { default>(def: Thunk): NumberSchema>; concat, UContext, UFlags extends Flags, UDefault>(schema: NumberSchema): NumberSchema, TContext & UContext, UDefault, TFlags | UFlags>; concat(schema: this): this; defined(msg?: Message): NumberSchema, TContext, TDefault, TFlags>; optional(): NumberSchema; required(msg?: Message): NumberSchema, TContext, TDefault, TFlags>; notRequired(): NumberSchema, TContext, TDefault, TFlags>; nullable(msg?: Message): NumberSchema; nonNullable(): NumberSchema, TContext, TDefault, TFlags>; strip(enabled: false): NumberSchema>; strip(enabled?: true): NumberSchema>; } declare function create$4(): DateSchema; declare function create$4 = AnyObject>(): DateSchema; declare namespace create$4 { var prototype: DateSchema; var INVALID_DATE: Date; } declare class DateSchema = Date | undefined, TContext = AnyObject, TDefault = undefined, TFlags extends Flags = ''> extends Schema { static INVALID_DATE: Date; constructor(); private prepareParam; min(min: unknown | Reference, message?: Message<{ min: string | Date; }>): this; max(max: unknown | Reference, message?: Message<{ max: string | Date; }>): this; } interface DateSchema, TContext = AnyObject, TDefault = undefined, TFlags extends Flags = ''> extends Schema { default>(def: Thunk): DateSchema>; concat>(schema: TOther): TOther; defined(msg?: Message): DateSchema, TContext, TDefault, TFlags>; optional(): DateSchema; required(msg?: Message): DateSchema, TContext, TDefault, TFlags>; notRequired(): DateSchema, TContext, TDefault, TFlags>; nullable(msg?: Message): DateSchema; nonNullable(): DateSchema, TContext, TDefault, TFlags>; strip(enabled: false): DateSchema>; strip(enabled?: true): DateSchema>; } declare type MakeKeysOptional = T extends AnyObject ? _> : T; declare type Shape, C = any> = { [field in keyof T]-?: ISchema | Reference; }; declare type ObjectSchemaSpec = SchemaSpec & { noUnknown?: boolean; }; declare function create$3 = AnyObject, S extends ObjectShape = {}>(spec?: S): ObjectSchema<_>, C, _>, "">; declare namespace create$3 { var prototype: ObjectSchema; } interface ObjectSchema, TContext = AnyObject, TDefault = any, TFlags extends Flags = ''> extends Schema, TContext, TDefault, TFlags> { default>(def: Thunk): ObjectSchema>; defined(msg?: Message): ObjectSchema, TContext, TDefault, TFlags>; optional(): ObjectSchema; required(msg?: Message): ObjectSchema, TContext, TDefault, TFlags>; notRequired(): ObjectSchema, TContext, TDefault, TFlags>; nullable(msg?: Message): ObjectSchema; nonNullable(): ObjectSchema, TContext, TDefault, TFlags>; strip(enabled: false): ObjectSchema>; strip(enabled?: true): ObjectSchema>; } declare class ObjectSchema, TContext = AnyObject, TDefault = any, TFlags extends Flags = ''> extends Schema, TContext, TDefault, TFlags> { fields: Shape, TContext>; spec: ObjectSchemaSpec; private _sortErrors; private _nodes; private _excludedEdges; constructor(spec?: Shape); protected _cast(_value: any, options?: InternalOptions): any; protected _validate(_value: any, options: InternalOptions | undefined, panic: (err: Error, value: unknown) => void, next: (err: ValidationError[], value: unknown) => void): void; clone(spec?: ObjectSchemaSpec): this; concat, IC, ID, IF extends Flags>(schema: ObjectSchema): ObjectSchema, TContext & IC, Extract extends never ? TDefault extends AnyObject ? ID extends AnyObject ? _> : ID : ID : ID, TFlags | IF>; concat(schema: this): this; protected _getDefault(): any; private setFields; shape(additions: U, excludes?: readonly [string, string][]): ObjectSchema<_<{ [P in keyof TIn]: P extends keyof U ? TypeFromShape[P] : TIn[P]; } & TypeFromShape> | _>, TContext, Extract extends never ? _> : TDefault, TFlags>; partial(): ObjectSchema, TContext, TDefault, TFlags>; deepPartial(): ObjectSchema, TContext, TDefault, TFlags>; pick(keys: readonly TKey[]): ObjectSchema<{ [K in TKey]: TIn[K]; }, TContext, TDefault, TFlags>; omit(keys: readonly TKey[]): ObjectSchema, TContext, TDefault, TFlags>; from(from: string, to: keyof TIn, alias?: boolean): this; /** Parse an input JSON string to an object */ json(): this; noUnknown(message?: Message): this; noUnknown(noAllow: boolean, message?: Message): this; unknown(allow?: boolean, message?: Message): this; transformKeys(fn: (key: string) => string): this; camelCase(): this; snakeCase(): this; constantCase(): this; describe(options?: ResolveOptions): SchemaObjectDescription; } declare type InnerType = T extends Array ? I : never; declare type RejectorFn = (value: any, index: number, array: readonly any[]) => boolean; declare function create$2 = AnyObject, T = any>(type?: ISchema): ArraySchema; declare namespace create$2 { var prototype: ArraySchema; } declare class ArraySchema extends Schema { readonly innerType?: ISchema, TContext>; constructor(type?: ISchema, TContext>); protected _cast(_value: any, _opts: InternalOptions): any; protected _validate(_value: any, options: InternalOptions | undefined, panic: (err: Error, value: unknown) => void, next: (err: ValidationError[], value: unknown) => void): void; clone(spec?: SchemaSpec): this; /** Parse an input JSON string to an object */ json(): this; concat, IC, ID, IF extends Flags>(schema: ArraySchema): ArraySchema, TContext & IC, Extract extends never ? TDefault : ID, TFlags | IF>; concat(schema: this): this; of(schema: ISchema): ArraySchema, TContext, TFlags>; length(length: number | Reference, message?: Message<{ length: number; }>): this; min(min: number | Reference, message?: Message<{ min: number; }>): this; max(max: number | Reference, message?: Message<{ max: number; }>): this; ensure(): ArraySchema>; compact(rejector?: RejectorFn): this; describe(options?: ResolveOptions): SchemaInnerTypeDescription; } interface ArraySchema extends Schema { default>(def: Thunk): ArraySchema>; defined(msg?: Message): ArraySchema, TContext, TDefault, TFlags>; optional(): ArraySchema; required(msg?: Message): ArraySchema, TContext, TDefault, TFlags>; notRequired(): ArraySchema, TContext, TDefault, TFlags>; nullable(msg?: Message): ArraySchema; nonNullable(): ArraySchema, TContext, TDefault, TFlags>; strip(enabled: false): ArraySchema>; strip(enabled?: true): ArraySchema>; } declare type AnyTuple = [unknown, ...unknown[]]; declare function create$1(schemas: { [K in keyof T]: ISchema; }): TupleSchema; declare namespace create$1 { var prototype: TupleSchema; } interface TupleSchemaSpec extends SchemaSpec { types: T extends any[] ? { [K in keyof T]: ISchema; } : never; } interface TupleSchema = AnyTuple | undefined, TContext = AnyObject, TDefault = undefined, TFlags extends Flags = ''> extends Schema { default>(def: Thunk): TupleSchema>; concat>(schema: TOther): TOther; defined(msg?: Message): TupleSchema, TContext, TDefault, TFlags>; optional(): TupleSchema; required(msg?: Message): TupleSchema, TContext, TDefault, TFlags>; notRequired(): TupleSchema, TContext, TDefault, TFlags>; nullable(msg?: Message): TupleSchema; nonNullable(): TupleSchema, TContext, TDefault, TFlags>; strip(enabled: false): TupleSchema>; strip(enabled?: true): TupleSchema>; } declare class TupleSchema = AnyTuple | undefined, TContext = AnyObject, TDefault = undefined, TFlags extends Flags = ''> extends Schema { spec: TupleSchemaSpec; constructor(schemas: [ISchema, ...ISchema[]]); protected _cast(inputValue: any, options: InternalOptions): any; protected _validate(_value: any, options: InternalOptions | undefined, panic: (err: Error, value: unknown) => void, next: (err: ValidationError[], value: unknown) => void): void; } declare function create, TContext extends Maybe = AnyObject>(builder: (value: any, options: ResolveOptions) => TSchema): Lazy, TContext, any>; interface LazySpec { meta: Record | undefined; optional: boolean; } declare class Lazy implements ISchema { private builder; type: "lazy"; __isYupSchema__: boolean; readonly __outputType: T; readonly __context: TContext; readonly __flags: TFlags; readonly __default: undefined; spec: LazySpec; constructor(builder: any); clone(spec?: Partial): Lazy; private _resolve; private optionality; optional(): Lazy; resolve(options: ResolveOptions): Schema; cast(value: any, options?: CastOptions$1): T; cast(value: any, options?: CastOptionalityOptions): T | null | undefined; asNestedTest(config: NestedTestConfig): RunTest; validate(value: any, options?: ValidateOptions): Promise; validateSync(value: any, options?: ValidateOptions): T; validateAt(path: string, value: any, options?: ValidateOptions): Promise; validateSyncAt(path: string, value: any, options?: ValidateOptions): any; isValid(value: any, options?: ValidateOptions): Promise; isValidSync(value: any, options?: ValidateOptions): boolean; describe(options?: ResolveOptions): SchemaLazyDescription | SchemaFieldDescription; meta(): Record | undefined; meta(obj: Record): Lazy; } declare function getIn(schema: any, path: string, value?: any, context?: C): { schema: ISchema | Reference; parent: any; parentPath: string; }; declare function reach

>(obj: S, path: P, value?: any, context?: any): Reference, P>> | ISchema, P>, S['__context']>; declare const isSchema: (obj: any) => obj is ISchema; declare function setLocale(custom: LocaleObject): void; declare function addMethod(schemaType: (...arg: any[]) => T, name: string, fn: (this: T, ...args: any[]) => T): void; declare function addMethod AnySchema>(schemaType: T, name: string, fn: (this: InstanceType, ...args: any[]) => InstanceType): void; declare type AnyObjectSchema = ObjectSchema; declare type CastOptions = Omit; export { AnyObject, AnyObjectSchema, AnySchema, ArraySchema, InferType as Asserts, BooleanSchema, CastOptions, CreateErrorOptions, DateSchema, DefaultFromShape, Defined, Flags, ISchema, InferType, LocaleObject, MakePartial, Maybe, Message, MixedOptions, MixedSchema, TypeGuard as MixedTypeGuard, NotNull, NumberSchema, ObjectSchema, ObjectShape, Optionals, Schema, SchemaDescription, SchemaFieldDescription, SchemaInnerTypeDescription, SchemaLazyDescription, SchemaObjectDescription, SchemaRefDescription, SetFlag, StringSchema, TestConfig, TestContext, TestFunction, TestOptions, Thunk, ToggleDefault, TupleSchema, TypeFromShape, UnsetFlag, ValidateOptions, ValidationError, addMethod, create$2 as array, create$7 as bool, create$7 as boolean, create$4 as date, getIn, isSchema, create as lazy, create$8 as mixed, create$5 as number, create$3 as object, reach, create$9 as ref, setLocale, create$6 as string, create$1 as tuple };