@types/yup
Advanced tools
Comparing version 0.28.1 to 0.28.2
@@ -76,10 +76,2 @@ // Type definitions for yup 0.28 | ||
when(keys: string | any[], builder: WhenOptions<this>): this; | ||
test( | ||
name: string, | ||
message: TestOptionsMessage, | ||
test: (this: TestContext, value?: any) => boolean | ValidationError | Promise<boolean | ValidationError>, | ||
callbackStyleAsync?: boolean, | ||
): this; | ||
// tslint:disable-next-line:no-unnecessary-generics | ||
test<P>(options: TestOptions<P>): this; | ||
transform(fn: TransformFunction<this>): this; | ||
@@ -105,2 +97,14 @@ } | ||
concat<U>(schema: MixedSchema<U>): MixedSchema<T | U>; | ||
test<U extends T = T>( | ||
name: string, | ||
message: TestOptionsMessage, | ||
test: AssertingTestFunction<U> | ||
): MixedSchema<U>; | ||
test( | ||
name: string, | ||
message: TestOptionsMessage, | ||
test: TestFunction | ||
): this; | ||
test<U extends T = T>(options: AssertingTestOptions<U, Record<string, any>>): MixedSchema<U>; | ||
test(options: TestOptions<Record<string, any>>): this; | ||
} | ||
@@ -135,2 +139,14 @@ | ||
notRequired(): StringSchema<T | undefined>; | ||
test<U extends T = T>( | ||
name: string, | ||
message: TestOptionsMessage, | ||
test: AssertingTestFunction<U> | ||
): StringSchema<U>; | ||
test( | ||
name: string, | ||
message: TestOptionsMessage, | ||
test: TestFunction | ||
): this; | ||
test<U extends T = T>(options: AssertingTestOptions<U, Record<string, any>>): StringSchema<U>; | ||
test(options: TestOptions<Record<string, any>>): this; | ||
optional(): StringSchema<T | undefined>; | ||
@@ -160,2 +176,14 @@ } | ||
notRequired(): NumberSchema<T | undefined>; | ||
test<U extends T = T>( | ||
name: string, | ||
message: TestOptionsMessage, | ||
test: AssertingTestFunction<U> | ||
): NumberSchema<U>; | ||
test( | ||
name: string, | ||
message: TestOptionsMessage, | ||
test: TestFunction | ||
): this; | ||
test<U extends T = T>(options: AssertingTestOptions<U, Record<string, any>>): NumberSchema<U>; | ||
test(options: TestOptions<Record<string, any>>): this; | ||
optional(): NumberSchema<T | undefined>; | ||
@@ -176,2 +204,14 @@ } | ||
notRequired(): BooleanSchema<T | undefined>; | ||
test<U extends T = T>( | ||
name: string, | ||
message: TestOptionsMessage, | ||
test: AssertingTestFunction<U> | ||
): BooleanSchema<U>; | ||
test( | ||
name: string, | ||
message: TestOptionsMessage, | ||
test: TestFunction | ||
): this; | ||
test<U extends T = T>(options: AssertingTestOptions<U, Record<string, any>>): BooleanSchema<U>; | ||
test(options: TestOptions<Record<string, any>>): this; | ||
optional(): BooleanSchema<T | undefined>; | ||
@@ -194,2 +234,14 @@ } | ||
notRequired(): DateSchema<T | undefined>; | ||
test<U extends T = T>( | ||
name: string, | ||
message: TestOptionsMessage, | ||
test: AssertingTestFunction<U> | ||
): DateSchema<U>; | ||
test( | ||
name: string, | ||
message: TestOptionsMessage, | ||
test: TestFunction | ||
): this; | ||
test<U extends T = T>(options: AssertingTestOptions<U, Record<string, any>>): DateSchema<U>; | ||
test(options: TestOptions<Record<string, any>>): this; | ||
optional(): DateSchema<T | undefined>; | ||
@@ -210,2 +262,4 @@ } | ||
): this; | ||
test(name: string, message: TestOptionsMessage, test: TestFunction): this; | ||
test(options: TestOptions<Record<string, any>>): this; | ||
innerType: Schema<E>; | ||
@@ -299,4 +353,19 @@ } | ||
concat<U extends object>(schema: ObjectSchema<U>): ObjectSchema<T & U>; | ||
test<U extends T = T>( | ||
name: string, | ||
message: TestOptionsMessage, | ||
test: AssertingTestFunction<U> | ||
): ObjectSchema<U>; | ||
test( | ||
name: string, | ||
message: TestOptionsMessage, | ||
test: TestFunction | ||
): this; | ||
test<U extends T = T>(options: AssertingTestOptions<U, Record<string, any>>): ObjectSchema<U>; | ||
test(options: TestOptions<Record<string, any>>): this; | ||
} | ||
export type TestFunction = (this: TestContext, value: any) => boolean | ValidationError | Promise<boolean | ValidationError>; | ||
export type AssertingTestFunction<T> = (this: TestContext, value: any) => value is T; | ||
export type TransformFunction<T> = (this: T, value: any, originalValue: any) => any; | ||
@@ -362,5 +431,5 @@ | ||
export interface TestOptions<P extends Record<string, any> = {}, R = any> { | ||
interface BaseTestOptions<P extends Record<string, any>> { | ||
/** | ||
* Unique name identifying the test | ||
* Unique name identifying the test. Required for exclusive tests. | ||
*/ | ||
@@ -372,3 +441,3 @@ name?: string; | ||
*/ | ||
test: (this: TestContext, value: any) => boolean | ValidationError | Promise<boolean | ValidationError>; | ||
test: TestFunction; | ||
@@ -378,3 +447,3 @@ /** | ||
*/ | ||
message?: TestOptionsMessage<P, R>; | ||
message?: TestOptionsMessage<P>; | ||
@@ -392,2 +461,25 @@ /** | ||
interface NonExclusiveTestOptions<P extends Record<string, any>> extends BaseTestOptions<P> { | ||
exclusive?: false; | ||
} | ||
interface ExclusiveTestOptions<P extends Record<string, any>> extends BaseTestOptions<P> { | ||
exclusive: true; | ||
name: string; | ||
} | ||
interface NonExclusiveAssertingTestOptions<U, P extends Record<string, any>> extends NonExclusiveTestOptions<P> { | ||
test: AssertingTestFunction<U>; | ||
} | ||
interface ExclusiveAssertingTestOptions<U, P extends Record<string, any>> extends ExclusiveTestOptions<P> { | ||
test: AssertingTestFunction<U>; | ||
} | ||
export type TestOptions<P extends Record<string, any> = {}> = | ||
NonExclusiveTestOptions<P> | ExclusiveTestOptions<P>; | ||
export type AssertingTestOptions<U, P extends Record<string, any> = {}> = | ||
NonExclusiveAssertingTestOptions<U, P> | ExclusiveAssertingTestOptions<U, P>; | ||
export interface SchemaFieldRefDescription { | ||
@@ -394,0 +486,0 @@ type: 'ref'; |
{ | ||
"name": "@types/yup", | ||
"version": "0.28.1", | ||
"version": "0.28.2", | ||
"description": "TypeScript definitions for yup", | ||
@@ -77,4 +77,4 @@ "license": "MIT", | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "61b5236e1997bfb404f28f0a165e5be0bda3529a3a46088800eb29a13ef6948c", | ||
"typesPublisherContentHash": "4ebb40cff5861051b56f3964f4358d6cf3ff1b608779fc9bbafbbda9d61b2fb0", | ||
"typeScriptVersion": "2.9" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
### Additional Details | ||
* Last updated: Fri, 08 May 2020 19:52:41 GMT | ||
* Last updated: Mon, 11 May 2020 14:00:14 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
28940
570