mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-03 22:37:03 +00:00
Add definition for isSchema() method signature
This commit is contained in:
Vendored
+1
@@ -26,6 +26,7 @@ export function addMethod<T extends Schema<any>>(
|
||||
export function ref(path: string, options?: { contextPrefix: string }): Ref;
|
||||
export function lazy<T>(fn: (value: T) => Schema<T>): Lazy;
|
||||
export function setLocale(customLocale: LocaleObject): void;
|
||||
export function isSchema(obj: any): obj is Schema<any>;
|
||||
|
||||
export const mixed: MixedSchemaConstructor;
|
||||
export const string: StringSchemaConstructor;
|
||||
|
||||
@@ -3,6 +3,7 @@ import * as yup from "yup";
|
||||
// tslint:disable-next-line:no-duplicate-imports
|
||||
import {
|
||||
reach,
|
||||
isSchema,
|
||||
date,
|
||||
Schema,
|
||||
ObjectSchema,
|
||||
@@ -24,6 +25,10 @@ const schema1 = yup.object().shape({
|
||||
reach(schema1, "nested.arr.num");
|
||||
reach(schema1, "nested.arr[].num");
|
||||
|
||||
// isSchema function
|
||||
const isSchemaResult1: boolean = isSchema(schema1);
|
||||
const isSchemaResult2: boolean = isSchema({});
|
||||
|
||||
// addMethod function
|
||||
yup.addMethod<NumberSchema>(yup.number, "minimum", function(
|
||||
this,
|
||||
|
||||
Reference in New Issue
Block a user