import { Get } from 'type-fest'; type Maybe = T | null | undefined; type Preserve = T extends U ? U : never; type Optionals = Extract; type Defined = T extends undefined ? never : T; type NotNull = T extends null ? never : T; type _ = T extends {} ? { [k in keyof T]: T[k]; } : T; type Flags = 's' | 'd' | ''; type SetFlag = Exclude | F; type UnsetFlag = Exclude extends never ? '' : Exclude; type ToggleDefault = Preserve extends never ? SetFlag : UnsetFlag; type ResolveFlags = Extract extends never ? T : D extends undefined ? T : Defined; type Concat = NonNullable & NonNullable extends never ? never : (NonNullable & NonNullable) | Optionals; type Params = Record; declare class ValidationError extends Error { value: any; path?: string; type?: string; params?: Params; errors: string[]; 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, disableStack?: boolean); static [Symbol.hasInstance](inst: any): boolean; [Symbol.toStringTag]: string; } type PanicCallback = (err: Error) => void; type NextCallback = (err: ValidationError[] | ValidationError | null) => void; type CreateErrorOptions = { path?: string; message?: Message; params?: ExtraParams; type?: string; disableStackTrace?: boolean; }; 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; }; type TestFunction = (this: TestContext, value: T, context: TestContext) => void | boolean | ValidationError | Promise; type TestOptions = { value: any; path?: string; options: InternalOptions; originalValue: any; schema: TSchema; }; type TestConfig = { name?: string; message?: Message; test: TestFunction; params?: ExtraParams; exclusive?: boolean; skipAbsent?: boolean; }; 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; } type SchemaSpec = { coerce: boolean; nullable: boolean; optional: boolean; default?: TDefault | (() => TDefault); abortEarly?: boolean; strip?: boolean; strict?: boolean; recursive?: boolean; disableStackTrace?: boolean; label?: string | undefined; meta?: SchemaMetadata; }; interface CustomSchemaMetadata { } type SchemaMetadata = keyof CustomSchemaMetadata extends never ? Record : CustomSchemaMetadata; type SchemaOptions = { type: string; spec?: Partial>; check: (value: any) => value is NonNullable; }; 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'; } type RunTest = (opts: TestOptions, panic: PanicCallback, next: NextCallback) => void; 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 | SchemaFieldDescription[]; } interface SchemaObjectDescription extends SchemaDescription { fields: Record; } interface SchemaLazyDescription { type: string; label?: string; meta?: SchemaMetadata; } type SchemaFieldDescription = SchemaDescription | SchemaRefDescription | SchemaObjectDescription | SchemaInnerTypeDescription | SchemaLazyDescription; interface SchemaDescription { type: string; label?: string; meta?: SchemaMetadata; oneOf: unknown[]; notOneOf: unknown[]; default?: 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(): SchemaMetadata | undefined; meta(obj: SchemaMetadata): 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(options?: ResolveOptions): any; getDefault(options?: ResolveOptions): TDefault; default(def: DefaultThunk): 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(builder: ConditionBuilder): this; when(keys: string | string[], builder: ConditionBuilder): this; when(options: ConditionConfig): this; when(keys: string | string[], options: ConditionConfig): this; 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']; } 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; } type ConditionBuilder> = (values: any[], schema: T, options: ResolveOptions) => ISchema; type ConditionConfig> = { is: any | ((...values: any[]) => boolean); then?: (schema: T) => ISchema; otherwise?: (schema: T) => ISchema; }; type ResolveOptions = { value?: any; parent?: any; context?: TContext; }; type ObjectShape = { [k: string]: ISchema | Reference; }; type AnyObject = { [k: string]: any; }; type ResolveStrip> = T extends ISchema ? Extract extends never ? T['__outputType'] : never : T['__outputType']; type TypeFromShape = { [K in keyof S]: S[K] extends ISchema ? ResolveStrip : S[K] extends Reference ? T : unknown; }; type DefaultFromShape = { [K in keyof Shape]: Shape[K] extends ISchema ? Shape[K]['__default'] : undefined; }; type ConcatObjectTypes, U extends Maybe> = ({ [P in keyof T]: P extends keyof NonNullable ? NonNullable[P] : T[P]; } & U) | Optionals; 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; }; type OptionalKeys = { [k in keyof T]: undefined extends T[k] ? k : never; }[keyof T]; type RequiredKeys = Exclude>; 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; } type DefaultThunk = T | ((options?: ResolveOptions) => T); type InferType> = T['__outputType']; 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; /** * When true ValidationError instance won't include stack trace information. Default - false */ disableStackTrace?: 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; originalPath: string; label: string; type: string; spec: SchemaSpec & Record; } type Message = any> = string | ((params: Extra & MessageParams) => unknown) | Record; type ExtraParams = Record; type AnyMessageParams = MessageParams & ExtraParams; interface NestedTestConfig { options: InternalOptions; parent: any; originalParent: any; parentPath: string | undefined; key?: string; index?: number; } type AnyPresentValue = {}; 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: DefaultThunk): 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(msg?: Message): 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: DefaultThunk): 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; }>; datetime?: Message; datetime_offset?: Message; datetime_precision?: Message<{ precision: number; }>; 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<{ unknown: string[]; }>; exact?: Message<{ properties: string[]; }>; } interface ArrayLocale { length?: Message<{ length: number; }>; min?: Message<{ min: number; }>; max?: Message<{ max: number; }>; } interface TupleLocale { notType?: Message; } interface BooleanLocale { isValue?: Message; } interface LocaleObject { mixed?: MixedLocale; string?: StringLocale; number?: NumberLocale; date?: DateLocale; boolean?: BooleanLocale; object?: ObjectLocale; array?: ArrayLocale; tuple?: TupleLocale; } declare const _default: LocaleObject; type MatchOptions = { excludeEmptyString?: boolean; message: Message<{ regex: RegExp; }>; name?: string; }; type DateTimeOptions = { message: Message<{ allowOffset?: boolean; precision?: number; }>; /** Allow a time zone offset. False requires UTC 'Z' timezone. (default: false) */ allowOffset?: boolean; /** Require a certain sub-second precision on the date. (default: undefined -- any or no sub-second precision) */ precision?: number; }; 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; datetime(options?: DateTimeOptions | DateTimeOptions['message']): 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: DefaultThunk): 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(msg?: Message): 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: DefaultThunk): 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(msg?: Message): 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: DefaultThunk): 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(msg?: Message): DateSchema, TContext, TDefault, TFlags>; strip(enabled: false): DateSchema>; strip(enabled?: true): DateSchema>; } type MakeKeysOptional = T extends AnyObject ? _> : T; type Shape, C = any> = { [field in keyof T]-?: ISchema | Reference; }; 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: DefaultThunk): 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(msg?: Message): 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?: Partial): 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(options?: ResolveOptions): 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<{ [K in Exclude]: TIn[K]; }, TContext, TDefault, TFlags>; from(from: string, to: keyof TIn, alias?: boolean): this; /** Parse an input JSON string to an object */ json(): this; /** * Similar to `noUnknown` but only validates that an object is the right shape without stripping the unknown keys */ exact(message?: Message): this; stripUnknown(): this; noUnknown(message?: Message): this; noUnknown(noAllow: boolean, message?: Message): this; unknown(allow?: boolean, message?: Message<{ unknown: string[]; }>): this; transformKeys(fn: (key: string) => string): this; camelCase(): this; snakeCase(): this; constantCase(): this; describe(options?: ResolveOptions): SchemaObjectDescription; } type InnerType = T extends Array ? I : never; 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; } interface ArraySchemaSpec extends SchemaSpec { types?: ISchema, TContext>; } declare class ArraySchema extends Schema { spec: ArraySchemaSpec; 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: DefaultThunk): 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(msg?: Message): ArraySchema, TContext, TDefault, TFlags>; strip(enabled: false): ArraySchema>; strip(enabled?: true): ArraySchema>; } 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: DefaultThunk): 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(msg?: Message): 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; describe(options?: ResolveOptions): SchemaInnerTypeDescription; } 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): any; 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 printValue(value: any, quoteStrings?: boolean): any; 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 ISchema>(schemaType: T, name: string, fn: (this: InstanceType, ...args: any[]) => InstanceType): void; type AnyObjectSchema = ObjectSchema; type CastOptions = Omit; export { AnyMessageParams, AnyObject, AnyObjectSchema, AnySchema, ArraySchema, InferType as Asserts, BooleanSchema, CastOptions, CreateErrorOptions, CustomSchemaMetadata, DateSchema, DefaultFromShape, DefaultThunk, Defined, Flags, ISchema, InferType, Lazy, Lazy as LazySchema, LocaleObject, MakePartial, Maybe, Message, MessageParams, MixedOptions, MixedSchema, TypeGuard as MixedTypeGuard, NotNull, NumberSchema, ObjectSchema, ObjectShape, Optionals, Reference, Schema, SchemaDescription, SchemaFieldDescription, SchemaInnerTypeDescription, SchemaLazyDescription, SchemaMetadata, SchemaObjectDescription, SchemaRefDescription, SetFlag, StringSchema, TestConfig, TestContext, TestFunction, TestOptions, ToggleDefault, TupleSchema, TypeFromShape, UnsetFlag, ValidateOptions, ValidationError, addMethod, create$2 as array, create$7 as bool, create$7 as boolean, create$4 as date, _default as defaultLocale, getIn, isSchema, create as lazy, create$8 as mixed, create$5 as number, create$3 as object, printValue, reach, create$9 as ref, setLocale, create$6 as string, create$1 as tuple };