From 2be1aea0d0700ca1b0be48b53dc6d49f252b2702 Mon Sep 17 00:00:00 2001 From: Matthew Bull Date: Thu, 31 Jan 2019 16:11:26 +0000 Subject: [PATCH 1/2] Add support for joi schema type --- types/joi/index.d.ts | 5 +++++ types/joi/joi-tests.ts | 2 ++ 2 files changed, 7 insertions(+) diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index 8f5e7b7a2a..ed94ed44b7 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -792,6 +792,11 @@ export interface ObjectSchema extends AnySchema { */ length(limit: number): this; + /** + * Requires the object to be a Joi schema instance. + */ + schema(): this; + /** * Specify validation rules for unknown keys matching a pattern. * diff --git a/types/joi/joi-tests.ts b/types/joi/joi-tests.ts index af85cab0ac..4dbc784756 100644 --- a/types/joi/joi-tests.ts +++ b/types/joi/joi-tests.ts @@ -706,6 +706,8 @@ objSchema = objSchema.nand(str, str); objSchema = objSchema.nand(str, str, str); objSchema = objSchema.nand(strArr); +objSchema = objSchema.schema(); + objSchema = objSchema.or(str); objSchema = objSchema.or(str, str); objSchema = objSchema.or(str, str, str); From c03d9fd2720e557d7853c663334c73ff0563b93b Mon Sep 17 00:00:00 2001 From: Matthew Bull Date: Thu, 31 Jan 2019 16:11:46 +0000 Subject: [PATCH 2/2] Fix linting --- types/joi/index.d.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/types/joi/index.d.ts b/types/joi/index.d.ts index ed94ed44b7..4ecf403a6f 100644 --- a/types/joi/index.d.ts +++ b/types/joi/index.d.ts @@ -488,7 +488,6 @@ export interface BooleanSchema extends AnySchema { /** * Allows the values provided to truthy and falsy as well as the "true" and "false" default conversion * (when not in strict() mode) to be matched in a case insensitive manner. - * @param enabled */ insensitive(enabled?: boolean): this; }