@types/yup
Advanced tools
Comparing version 0.24.0 to 0.24.1
// Type definitions for yup 0.24 | ||
// Project: https://github.com/jquense/yup | ||
// Definitions by: Dominik Hardtke <https://github.com/dhardtke>, Vladyslav Tserman <https://github.com/vtserman> | ||
// Definitions by: Dominik Hardtke <https://github.com/dhardtke>, Vladyslav Tserman <https://github.com/vtserman>, Moreton Bay Regional Council <https://github.com/MoretonBayRC> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
// TypeScript Version: 2.2 | ||
export function reach(schema: Schema, path: string, value?: any, context?: any): Schema; | ||
export function addMethod<T extends Schema>(schemaCtor: AnySchemaConstructor, name: string, method: (this: T, ...args: any[]) => T): void; | ||
export function reach<T>(schema: Schema<T>, path: string, value?: any, context?: any): Schema<T>; | ||
export function addMethod<T extends Schema<any>>(schemaCtor: AnySchemaConstructor, name: string, method: (this: T, ...args: any[]) => T): void; | ||
export function ref(path: string, options?: { contextPrefix: string }): Ref; | ||
export function lazy(fn: (value: any) => Schema): Lazy; | ||
export function lazy<T>(fn: (value: T) => Schema<T>): Lazy; | ||
export function ValidationError(errors: string | string[], value: any, path: string, type?: any): ValidationError; | ||
@@ -30,3 +30,3 @@ | ||
export interface Schema { | ||
export interface Schema<T> { | ||
clone(): this; | ||
@@ -38,8 +38,8 @@ label(label: string): this; | ||
concat(schema: this): this; | ||
validate<U>(value: U, options?: ValidateOptions): Promise<ValidationError|U>; | ||
validateSync<U>(value: U, options?: ValidateOptions): ValidationError|U; | ||
isValid(value: any, options?: any): Promise<boolean>; | ||
isValidSync(value: any, options?: any): boolean; | ||
cast(value: any, options?: any): any; | ||
isType(value: any): boolean; | ||
validate(value: T, options?: ValidateOptions): Promise<ValidationError|T>; | ||
validateSync(value: T, options?: ValidateOptions): ValidationError|T; | ||
isValid(value: T, options?: any): Promise<boolean>; | ||
isValidSync(value: T, options?: any): boolean; | ||
cast(value: any, options?: any): T; | ||
isType(value: any): value is T; | ||
strict(isStrict: boolean): this; | ||
@@ -66,3 +66,3 @@ strip(strip: boolean): this; | ||
// tslint:disable-next-line:no-empty-interface | ||
export interface MixedSchema extends Schema { | ||
export interface MixedSchema extends Schema<any> { | ||
} | ||
@@ -75,3 +75,3 @@ | ||
export interface StringSchema extends Schema { | ||
export interface StringSchema extends Schema<string> { | ||
min(limit: number | Ref, message?: string): StringSchema; | ||
@@ -93,3 +93,3 @@ max(limit: number | Ref, message?: string): StringSchema; | ||
export interface NumberSchema extends Schema { | ||
export interface NumberSchema extends Schema<number> { | ||
min(limit: number | Ref, message?: string): NumberSchema; | ||
@@ -112,3 +112,3 @@ max(limit: number | Ref, message?: string): NumberSchema; | ||
// tslint:disable-next-line:no-empty-interface | ||
export interface BooleanSchema extends Schema { | ||
export interface BooleanSchema extends Schema<boolean> { | ||
} | ||
@@ -121,3 +121,3 @@ | ||
export interface DateSchema extends Schema { | ||
export interface DateSchema extends Schema<Date> { | ||
min(limit: Date | string | Ref, message?: string): DateSchema; | ||
@@ -128,26 +128,26 @@ max(limit: Date | string | Ref, message?: string): DateSchema; | ||
export interface ArraySchemaConstructor { | ||
(): ArraySchema; | ||
new(): ArraySchema; | ||
<T>(schema?: Schema<T>): ArraySchema<T>; | ||
new(): ArraySchema<{}>; | ||
} | ||
export interface ArraySchema extends Schema { | ||
of(type: Schema): ArraySchema; | ||
min(limit: number | Ref, message?: string): ArraySchema; | ||
max(limit: number | Ref, message?: string): ArraySchema; | ||
ensure(): ArraySchema; | ||
compact(rejector: (value: any) => boolean): ArraySchema; | ||
export interface ArraySchema<T> extends Schema<T[]> { | ||
of<U>(type: Schema<U>): ArraySchema<U>; | ||
min(limit: number | Ref, message?: string): ArraySchema<T>; | ||
max(limit: number | Ref, message?: string): ArraySchema<T>; | ||
ensure(): ArraySchema<T>; | ||
compact(rejector: (value: any) => boolean): ArraySchema<T>; | ||
} | ||
export interface ObjectSchemaConstructor { | ||
(fields?: any): ObjectSchema; | ||
new(): ObjectSchema; | ||
<T>(fields?: { [field in keyof T]: Schema<T[field]> }): ObjectSchema<T>; | ||
new (): ObjectSchema<{}>; | ||
} | ||
export interface ObjectSchema extends Schema { | ||
shape(fields: any, noSortEdges?: Array<[string, string]>): ObjectSchema; | ||
from(fromKey: string, toKey: string, alias?: boolean): ObjectSchema; | ||
noUnknown(onlyKnownKeys: boolean, message?: string): ObjectSchema; | ||
export interface ObjectSchema<T> extends Schema<T> { | ||
shape(fields: { [field in keyof T]: Schema<T[field]> }, noSortEdges?: Array<[string, string]>): ObjectSchema<T>; | ||
from(fromKey: string, toKey: string, alias?: boolean): ObjectSchema<T>; | ||
noUnknown(onlyKnownKeys: boolean, message?: string): ObjectSchema<T>; | ||
transformKeys(callback: (key: any) => any): void; | ||
camelCase(): ObjectSchema; | ||
constantCase(): ObjectSchema; | ||
camelCase(): ObjectSchema<T>; | ||
constantCase(): ObjectSchema<T>; | ||
} | ||
@@ -251,3 +251,3 @@ | ||
// tslint:disable-next-line:no-empty-interface | ||
export interface Lazy extends Schema { | ||
export interface Lazy extends Schema<any> { | ||
} | ||
@@ -262,4 +262,4 @@ | ||
date?: { [key in keyof DateSchema]?: string }; | ||
array?: { [key in keyof ArraySchema]?: string }; | ||
object?: { [key in keyof ObjectSchema]?: string }; | ||
array?: { [key in keyof ArraySchema<any>]?: string }; | ||
object?: { [key in keyof ObjectSchema<any>]?: string }; | ||
} |
{ | ||
"name": "@types/yup", | ||
"version": "0.24.0", | ||
"version": "0.24.1", | ||
"description": "TypeScript definitions for yup", | ||
@@ -16,2 +16,7 @@ "license": "MIT", | ||
"githubUsername": "vtserman" | ||
}, | ||
{ | ||
"name": "Moreton Bay Regional Council", | ||
"url": "https://github.com/MoretonBayRC", | ||
"githubUsername": "MoretonBayRC" | ||
} | ||
@@ -26,4 +31,4 @@ ], | ||
"dependencies": {}, | ||
"typesPublisherContentHash": "71ef2614b621725a75571c251dfc2e813e9929a8b5c1acca15f55d4d488549d1", | ||
"typesPublisherContentHash": "fba262445e8a20ffe29c0f03461e323089e353df6985f43513bc03c2cee6f3c9", | ||
"typeScriptVersion": "2.2" | ||
} |
@@ -11,3 +11,3 @@ # Installation | ||
Additional Details | ||
* Last updated: Thu, 18 Jan 2018 23:56:37 GMT | ||
* Last updated: Thu, 15 Feb 2018 21:25:40 GMT | ||
* Dependencies: none | ||
@@ -17,2 +17,2 @@ * Global values: none | ||
# Credits | ||
These definitions were written by Dominik Hardtke <https://github.com/dhardtke>, Vladyslav Tserman <https://github.com/vtserman>. | ||
These definitions were written by Dominik Hardtke <https://github.com/dhardtke>, Vladyslav Tserman <https://github.com/vtserman>, Moreton Bay Regional Council <https://github.com/MoretonBayRC>. |
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
11257