Socket
Socket
Sign inDemoInstall

@types/yup

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/yup - npm Package Compare versions

Comparing version 0.28.2 to 0.28.3

53

yup/index.d.ts

@@ -16,3 +16,3 @@ // Type definitions for yup 0.28

// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
// TypeScript Version: 3.6

@@ -74,3 +74,2 @@ 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?: MixedLocale['oneOf']): this;
notOneOf(arrayOfValues: any[], message?: MixedLocale['notOneOf']): this;

@@ -88,3 +87,3 @@ when(keys: string | any[], builder: WhenOptions<this>): this;

export interface MixedSchema<T = any> extends Schema<T> {
export interface MixedSchema<T extends any = NotUndefined> extends Schema<T> {
nullable(isNullable?: true): MixedSchema<T | null>;

@@ -98,3 +97,5 @@ nullable(isNullable: false): MixedSchema<Exclude<T, null>>;

concat(schema: this): this;
concat<U>(schema: MixedSchema<U>): MixedSchema<T | U>;
concat<U>(schema: Schema<U>): MixedSchema<T | U>;
oneOf<U extends T>(arrayOfValues: ReadonlyArray<U | Ref | null>, message?: MixedLocale['oneOf']): MixedSchema<MaintainOptionality<T, U>>;
equals<U extends T>(arrayOfValues: ReadonlyArray<U | Ref | null>, message?: MixedLocale['oneOf']): MixedSchema<MaintainOptionality<T, U>>;
test<U extends T = T>(

@@ -141,2 +142,4 @@ name: string,

notRequired(): StringSchema<T | undefined>;
oneOf<U extends T>(arrayOfValues: ReadonlyArray<U | Ref | null>, message?: MixedLocale['oneOf']): StringSchema<MaintainOptionality<T, U>>;
equals<U extends T>(arrayOfValues: ReadonlyArray<U | Ref | null>, message?: MixedLocale['oneOf']): StringSchema<MaintainOptionality<T, U>>;
test<U extends T = T>(

@@ -178,2 +181,4 @@ name: string,

notRequired(): NumberSchema<T | undefined>;
oneOf<U extends T>(arrayOfValues: ReadonlyArray<U | Ref | null>, message?: MixedLocale['oneOf']): NumberSchema<MaintainOptionality<T, U>>;
equals<U extends T>(arrayOfValues: ReadonlyArray<U | Ref | null>, message?: MixedLocale['oneOf']): NumberSchema<MaintainOptionality<T, U>>;
test<U extends T = T>(

@@ -206,2 +211,4 @@ name: string,

notRequired(): BooleanSchema<T | undefined>;
oneOf<U extends T>(arrayOfValues: ReadonlyArray<U | Ref | null>, message?: MixedLocale['oneOf']): BooleanSchema<MaintainOptionality<T, U>>;
equals<U extends T>(arrayOfValues: ReadonlyArray<U | Ref | null>, message?: MixedLocale['oneOf']): BooleanSchema<MaintainOptionality<T, U>>;
test<U extends T = T>(

@@ -236,2 +243,4 @@ name: string,

notRequired(): DateSchema<T | undefined>;
oneOf<U extends T>(arrayOfValues: ReadonlyArray<U | Ref | null>, message?: MixedLocale['oneOf']): DateSchema<MaintainOptionality<T, U>>;
equals<U extends T>(arrayOfValues: ReadonlyArray<U | Ref | null>, message?: MixedLocale['oneOf']): DateSchema<MaintainOptionality<T, U>>;
test<U extends T = T>(

@@ -264,2 +273,9 @@ name: string,

): this;
// This doesn't narrow the type of the schema like the more primitive oneOf calls
// it would be very complex to do that accurately with the subtypes, and it's not
// really worth it because the oneOf check is a shallow (==) comparison so it rarely
// applies to arrays anyway.
oneOf(arrayOfValues: ReadonlyArray<T | Ref | null>, message?: MixedLocale['oneOf']): this;
equals(arrayOfValues: ReadonlyArray<T | Ref | null>, message?: MixedLocale['oneOf']): this;
test(name: string, message: TestOptionsMessage, test: TestFunction): this;

@@ -314,3 +330,7 @@ test(options: TestOptions<Record<string, any>>): this;

export type ObjectSchemaDefinition<T extends object | null | undefined> = {
[field in keyof T]: Schema<T[field]> | Ref;
// This shouldn't be necessary because MixedSchema extends Schema, but type
// inference only works with it this way - otherwise when you use a mixed
// field in object schema, it will type as `unknown`. Not sure why that is -
// maybe some sort of inference depth limit?
[field in keyof T]: Schema<T[field]> | MixedSchema<T[field]> | Ref;
};

@@ -324,4 +344,4 @@

export type Shape<T extends object | null | undefined, U extends object> =
| ({ [P in keyof T]: P extends keyof U ? U[P] : T[P]; } & U)
| PreserveOptionals<T>;
| ({ [P in keyof T]: P extends keyof U ? U[P] : T[P] } & U)
| PreserveOptionals<T>;

@@ -335,3 +355,3 @@ export interface ObjectSchemaConstructor {

fields: {
[k in keyof T]: Schema<T[k]>
[k in keyof T]: Schema<T[k]>;
};

@@ -358,2 +378,4 @@ shape<U extends object>(

concat<U extends object>(schema: ObjectSchema<U>): ObjectSchema<T & U>;
oneOf<U extends T>(arrayOfValues: ReadonlyArray<U | Ref | null>, message?: MixedLocale['oneOf']): ObjectSchema<U>;
equals<U extends T>(arrayOfValues: ReadonlyArray<U | Ref | null>, message?: MixedLocale['oneOf']): ObjectSchema<U>;
test<U extends T = T>(

@@ -403,3 +425,3 @@ name: string,

resolve: (value: any) => any;
createError: (params?: { path?: string; message?: string, params?: object }) => ValidationError;
createError: (params?: { path?: string; message?: string; params?: object }) => ValidationError;
}

@@ -492,12 +514,8 @@

export interface SchemaFieldInnerTypeDescription extends Pick<
SchemaDescription, Exclude<keyof SchemaDescription, 'fields'>
> {
export interface SchemaFieldInnerTypeDescription
extends Pick<SchemaDescription, Exclude<keyof SchemaDescription, 'fields'>> {
innerType?: SchemaFieldDescription;
}
export type SchemaFieldDescription =
| SchemaDescription
| SchemaFieldRefDescription
| SchemaFieldInnerTypeDescription;
export type SchemaFieldDescription = SchemaDescription | SchemaFieldRefDescription | SchemaFieldInnerTypeDescription;

@@ -655,1 +673,4 @@ export interface SchemaDescription {

type InferredArrayType<T> = T extends Array<infer U> ? U : T;
/** If `T` is optional, returns optional `U`. */
type MaintainOptionality<T, U> = T extends undefined ? U | undefined : U;
type NotUndefined = string | number | boolean | symbol | object | null;
{
"name": "@types/yup",
"version": "0.28.2",
"version": "0.28.3",
"description": "TypeScript definitions for yup",

@@ -77,4 +77,4 @@ "license": "MIT",

"dependencies": {},
"typesPublisherContentHash": "4ebb40cff5861051b56f3964f4358d6cf3ff1b608779fc9bbafbbda9d61b2fb0",
"typeScriptVersion": "2.9"
"typesPublisherContentHash": "f5153506cbc20b41b54c1590fb35c74ee2ce7d82717b735fdb4e3a1efdbd3ff9",
"typeScriptVersion": "3.6"
}

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

### Additional Details
* Last updated: Mon, 11 May 2020 14:00:14 GMT
* Last updated: Mon, 11 May 2020 15:13:07 GMT
* Dependencies: none

@@ -14,0 +14,0 @@ * Global values: none

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc