Socket
Socket
Sign inDemoInstall

@types/yup

Package Overview
Dependencies
0
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.26.3 to 0.26.4

55

yup/index.d.ts

@@ -9,2 +9,3 @@ // Type definitions for yup 0.26

// Vincent Pizzo <https://github.com/vincentjames501>
// Robert Bullen <https://github.com/robertbullen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

@@ -62,8 +63,8 @@ // TypeScript Version: 2.2

concat(schema: this): this;
validate(value: T, options?: ValidateOptions): Promise<T>;
validateSync(value: T, options?: ValidateOptions): T;
validate(value: any, options?: ValidateOptions): Promise<T>;
validateSync(value: any, options?: ValidateOptions): T;
validateAt(path: string, value: T, options?: ValidateOptions): Promise<T>;
validateSyncAt(path: string, value: T, options?: ValidateOptions): T;
isValid(value: T, options?: any): Promise<boolean>;
isValidSync(value: T, options?: any): boolean;
isValid(value: any, options?: any): Promise<boolean>;
isValidSync(value: any, options?: any): value is T;
cast(value: any, options?: any): T;

@@ -175,12 +176,21 @@ isType(value: any): value is T;

export type ObjectSchemaDefinition<T extends object> = { [field in keyof T]: Schema<T[field]> | Ref };
/**
* Merges two interfaces. For properties in common, property types from `U` trump those of `T`.
* This is conducive to the functionality of
* [yup's `object.shape()` method](https://www.npmjs.com/package/yup#objectshapefields-object-nosortedges-arraystring-string-schema).
*/
export type Shape<T extends object, U extends object> = { [P in keyof T]: P extends keyof U ? U[P] : T[P] } & U;
export interface ObjectSchemaConstructor {
<T>(fields?: { [field in keyof T]: Schema<T[field]> }): ObjectSchema<T>;
<T extends object>(fields?: ObjectSchemaDefinition<T>): ObjectSchema<T>;
new (): ObjectSchema<{}>;
}
export interface ObjectSchema<T> extends Schema<T> {
shape(
fields: { [field in keyof T]: Schema<T[field]> },
export interface ObjectSchema<T extends object> extends Schema<T> {
shape<U extends object>(
fields: ObjectSchemaDefinition<U>,
noSortEdges?: Array<[string, string]>
): ObjectSchema<T>;
): ObjectSchema<Shape<T, U>>;
from(fromKey: string, toKey: string, alias?: boolean): ObjectSchema<T>;

@@ -309,4 +319,27 @@ noUnknown(onlyKnownKeys?: boolean, message?: TestOptionsMessage): ObjectSchema<T>;

export interface Ref {
[key: string]: any;
// It is tempting to declare `Ref` very simply, but there are problems with these approaches:
//
// * `type Ref = Record<string, any>;` - This is essentially how it was originally declared, but
// just about any object satisfies this contract, which makes the type declaration too loose to
// be useful.
//
// * `type Ref = object;` - This is a variation on the previous bullet in that it is too loose.
//
// * `class Ref {}` - This is yet another variation that is too loose.
//
// * `type Ref = void;` - This works and the emitted JavaScript is just fine, but it results in some
// confusing IntelliSense, e.g it looks like the `ref()` returns `void`, which is not the case.
//
// The solution is twofold. 1.) Declare it as a class with a private constructor to prevent it from
// being instantiated by anything but the `ref()` factory function, and; 2.) declare a private
// readonly property (that yup actually places on the prototype) to force it to be structurally
// incompatible with any other object type.
/**
* `Ref` is an opaque type that is internal to yup. Creating a `Ref` instance is accomplished via the `ref()` factory
* function.
*/
export class Ref {
private constructor();
private readonly __isYupRef: true;
}

@@ -313,0 +346,0 @@

9

yup/package.json
{
"name": "@types/yup",
"version": "0.26.3",
"version": "0.26.4",
"description": "TypeScript definitions for yup",

@@ -36,2 +36,7 @@ "license": "MIT",

"githubUsername": "vincentjames501"
},
{
"name": "Robert Bullen",
"url": "https://github.com/robertbullen",
"githubUsername": "robertbullen"
}

@@ -47,4 +52,4 @@ ],

"dependencies": {},
"typesPublisherContentHash": "1bdd3502b1954da185fe21247b1f5fe0dd1a97efbc58ad26d861f4e9fb9fadf8",
"typesPublisherContentHash": "736012aeca6158962cf8327dcaee0a154e84468a44cd39ce2dc2ac04b77d3938",
"typeScriptVersion": "2.2"
}

@@ -11,3 +11,3 @@ # Installation

Additional Details
* Last updated: Tue, 04 Dec 2018 21:42:10 GMT
* Last updated: Mon, 31 Dec 2018 18:36:33 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>, Moreton Bay Regional Council <https://github.com/MoretonBayRC>, Sindre Seppola <https://github.com/sseppola>, Yash Kulshrestha <https://github.com/YashdalfTheGray>, Vincent Pizzo <https://github.com/vincentjames501>.
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>, Sindre Seppola <https://github.com/sseppola>, Yash Kulshrestha <https://github.com/YashdalfTheGray>, Vincent Pizzo <https://github.com/vincentjames501>, Robert Bullen <https://github.com/robertbullen>.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc