Add definition for isSchema() method signature

This commit is contained in:
Anton Evzhakov
2019-02-06 19:16:49 +02:00
parent ab0806bfb5
commit f86b9137fb
2 changed files with 6 additions and 0 deletions
+1
View File
@@ -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;
+5
View File
@@ -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,