@types/yup
Advanced tools
Comparing version 0.26.23 to 0.26.24
@@ -16,3 +16,3 @@ // Type definitions for yup 0.26 | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 3.1 | ||
// TypeScript Version: 2.8 | ||
@@ -73,4 +73,4 @@ export function reach<T>(schema: Schema<T>, path: string, value?: any, context?: any): Schema<T>; | ||
typeError(message?: TestOptionsMessage): this; | ||
oneOf(arrayOfValues: Array<T | Ref | null>, message?: TestOptionsMessage<{ values: T | Ref }>): this; | ||
notOneOf(arrayOfValues: any[], message?: TestOptionsMessage<{ values: T | Ref }>): this; | ||
oneOf(arrayOfValues: Array<T | Ref | null>, message?: MixedLocale['oneOf']): this; | ||
notOneOf(arrayOfValues: any[], message?: MixedLocale['notOneOf']): this; | ||
when(keys: string | any[], builder: WhenOptions<this>): this; | ||
@@ -111,17 +111,17 @@ test( | ||
export interface StringSchema<T extends string | null | undefined = string> extends Schema<T> { | ||
length(limit: number | Ref, message?: TestOptionsMessage<{ length: number | Ref }>): StringSchema<T>; | ||
min(limit: number | Ref, message?: TestOptionsMessage<{ min: number | Ref }>): StringSchema<T>; | ||
max(limit: number | Ref, message?: TestOptionsMessage<{ max: number | Ref }>): StringSchema<T>; | ||
length(limit: number | Ref, message?: StringLocale['length']): StringSchema<T>; | ||
min(limit: number | Ref, message?: StringLocale['min']): StringSchema<T>; | ||
max(limit: number | Ref, message?: StringLocale['max']): StringSchema<T>; | ||
matches( | ||
regex: RegExp, | ||
messageOrOptions?: | ||
| TestOptionsMessage<{ regex: RegExp }> | ||
| { message?: TestOptionsMessage<{ regex: RegExp }>; excludeEmptyString?: boolean }, | ||
| StringLocale['matches'] | ||
| { message?: StringLocale['matches']; excludeEmptyString?: boolean }, | ||
): StringSchema<T>; | ||
email(message?: TestOptionsMessage<{ regex: RegExp }>): StringSchema<T>; | ||
url(message?: TestOptionsMessage<{ regex: RegExp }>): StringSchema<T>; | ||
email(message?: StringLocale['email']): StringSchema<T>; | ||
url(message?: StringLocale['url']): StringSchema<T>; | ||
ensure(): StringSchema<T>; | ||
trim(message?: TestOptionsMessage): StringSchema<T>; | ||
lowercase(message?: TestOptionsMessage): StringSchema<T>; | ||
uppercase(message?: TestOptionsMessage): StringSchema<T>; | ||
trim(message?: StringLocale['trim']): StringSchema<T>; | ||
lowercase(message?: StringLocale['lowercase']): StringSchema<T>; | ||
uppercase(message?: StringLocale['uppercase']): StringSchema<T>; | ||
nullable(isNullable?: true): StringSchema<T | null>; | ||
@@ -140,9 +140,9 @@ nullable(isNullable: false): StringSchema<Exclude<T, null>>; | ||
export interface NumberSchema<T extends number | null | undefined = number> extends Schema<T> { | ||
min(limit: number | Ref, message?: TestOptionsMessage<{ min: number }>): NumberSchema<T>; | ||
max(limit: number | Ref, message?: TestOptionsMessage<{ max: number }>): NumberSchema<T>; | ||
lessThan(limit: number | Ref, message?: TestOptionsMessage<{ less: number }>): NumberSchema<T>; | ||
moreThan(limit: number | Ref, message?: TestOptionsMessage<{ more: number }>): NumberSchema<T>; | ||
positive(message?: TestOptionsMessage<{ more: number }>): NumberSchema<T>; | ||
negative(message?: TestOptionsMessage<{ less: number }>): NumberSchema<T>; | ||
integer(message?: TestOptionsMessage): NumberSchema<T>; | ||
min(limit: number | Ref, message?: NumberLocale['min']): NumberSchema<T>; | ||
max(limit: number | Ref, message?: NumberLocale['max']): NumberSchema<T>; | ||
lessThan(limit: number | Ref, message?: NumberLocale['lessThan']): NumberSchema<T>; | ||
moreThan(limit: number | Ref, message?: NumberLocale['moreThan']): NumberSchema<T>; | ||
positive(message?: NumberLocale['positive']): NumberSchema<T>; | ||
negative(message?: NumberLocale['negative']): NumberSchema<T>; | ||
integer(message?: NumberLocale['integer']): NumberSchema<T>; | ||
truncate(): NumberSchema<T>; | ||
@@ -176,4 +176,4 @@ round(type: 'floor' | 'ceil' | 'trunc' | 'round'): NumberSchema<T>; | ||
export interface DateSchema<T extends Date | null | undefined = Date> extends Schema<T> { | ||
min(limit: Date | string | Ref, message?: TestOptionsMessage<{ min: Date | string }>): DateSchema<T>; | ||
max(limit: Date | string | Ref, message?: TestOptionsMessage<{ max: Date | string }>): DateSchema<T>; | ||
min(limit: Date | string | Ref, message?: DateLocale['min']): DateSchema<T>; | ||
max(limit: Date | string | Ref, message?: DateLocale['max']): DateSchema<T>; | ||
nullable(isNullable?: true): DateSchema<T | null>; | ||
@@ -192,4 +192,4 @@ nullable(isNullable: false): DateSchema<Exclude<T, null>>; | ||
interface BasicArraySchema<T extends any[] | null | undefined> extends Schema<T> { | ||
min(limit: number | Ref, message?: TestOptionsMessage<{ min: number }>): this; | ||
max(limit: number | Ref, message?: TestOptionsMessage<{ max: number }>): this; | ||
min(limit: number | Ref, message?: ArrayLocale['min']): this; | ||
max(limit: number | Ref, message?: ArrayLocale['max']): this; | ||
ensure(): this; | ||
@@ -261,3 +261,3 @@ compact( | ||
from(fromKey: string, toKey: string, alias?: boolean): ObjectSchema<T>; | ||
noUnknown(onlyKnownKeys?: boolean, message?: TestOptionsMessage): ObjectSchema<T>; | ||
noUnknown(onlyKnownKeys?: boolean, message?: ObjectLocale['noUnknown']): ObjectSchema<T>; | ||
transformKeys(callback: (key: any) => any): void; | ||
@@ -440,19 +440,54 @@ camelCase(): ObjectSchema<T>; | ||
type MessageFromParameters<P extends unknown[]> = { | ||
[K in keyof P]: P[K] extends TestOptionsMessage<any> ? P[K] : never; | ||
}[number]; | ||
interface MixedLocale { | ||
default?: TestOptionsMessage; | ||
required?: TestOptionsMessage; | ||
oneOf?: TestOptionsMessage<{ values: any }>; | ||
notOneOf?: TestOptionsMessage<{ values: any }>; | ||
notType?: LocaleValue; | ||
} | ||
type MappedLocaleSchema<S extends Schema<any>> = { | ||
[key in keyof S]?: S[key] extends (...args: infer P) => any ? MessageFromParameters<Required<P>> : never; | ||
}; | ||
interface StringLocale { | ||
length?: TestOptionsMessage<{ length: number }>; | ||
min?: TestOptionsMessage<{ min: number }>; | ||
max?: TestOptionsMessage<{ max: number }>; | ||
matches?: TestOptionsMessage<{ regex: RegExp }>; | ||
email?: TestOptionsMessage<{ regex: RegExp }>; | ||
url?: TestOptionsMessage<{ regex: RegExp }>; | ||
trim?: TestOptionsMessage; | ||
lowercase?: TestOptionsMessage; | ||
uppercase?: TestOptionsMessage; | ||
} | ||
interface NumberLocale { | ||
min?: TestOptionsMessage<{ min: number }>; | ||
max?: TestOptionsMessage<{ max: number }>; | ||
lessThan?: TestOptionsMessage<{ less: number }>; | ||
moreThan?: TestOptionsMessage<{ more: number }>; | ||
positive?: TestOptionsMessage<{ more: number }>; | ||
negative?: TestOptionsMessage<{ less: number }>; | ||
integer?: TestOptionsMessage; | ||
} | ||
interface DateLocale { | ||
min?: TestOptionsMessage<{ min: Date | string }>; | ||
max?: TestOptionsMessage<{ max: Date | string }>; | ||
} | ||
interface ObjectLocale { | ||
noUnknown?: TestOptionsMessage; | ||
} | ||
interface ArrayLocale { | ||
min?: TestOptionsMessage<{ min: number }>; | ||
max?: TestOptionsMessage<{ max: number }>; | ||
} | ||
export interface LocaleObject { | ||
mixed?: MappedLocaleSchema<MixedSchema> & { notType?: LocaleValue }; | ||
string?: MappedLocaleSchema<StringSchema>; | ||
number?: MappedLocaleSchema<NumberSchema>; | ||
boolean?: MappedLocaleSchema<BooleanSchema>; | ||
bool?: MappedLocaleSchema<BooleanSchema>; | ||
date?: MappedLocaleSchema<DateSchema>; | ||
array?: MappedLocaleSchema<ArraySchema<any>>; | ||
object?: MappedLocaleSchema<ObjectSchema<any>>; | ||
mixed?: MixedLocale; | ||
string?: StringLocale; | ||
number?: NumberLocale; | ||
date?: DateLocale; | ||
boolean?: {}; | ||
object?: ObjectLocale; | ||
array?: ArrayLocale; | ||
} | ||
@@ -459,0 +494,0 @@ |
{ | ||
"name": "@types/yup", | ||
"version": "0.26.23", | ||
"version": "0.26.24", | ||
"description": "TypeScript definitions for yup", | ||
@@ -77,4 +77,4 @@ "license": "MIT", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "5ee48019095c6520dc294726f8375399a2c276679687079b9b4e53da51426958", | ||
"typeScriptVersion": "3.1" | ||
"typesPublisherContentHash": "cc325fb40f64855ed2363f13b90ea93da4a40c26b5ee7d2e0b309ffdd915e052", | ||
"typeScriptVersion": "2.8" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Tue, 20 Aug 2019 18:58:56 GMT | ||
* Last updated: Mon, 16 Sep 2019 21:10:07 GMT | ||
* Dependencies: none | ||
@@ -14,0 +14,0 @@ * Global values: none |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23627
441