From 01c69305424db349ff701fae7cdb31e569c38b6e Mon Sep 17 00:00:00 2001 From: Jason Quense Date: Mon, 7 Dec 2020 16:27:01 -0500 Subject: [PATCH] fix(types): change base.default() to any --- src/object.ts | 6 +++--- src/schema.ts | 6 ++---- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/object.ts b/src/object.ts index 843a62e5e..6bba24986 100644 --- a/src/object.ts +++ b/src/object.ts @@ -460,7 +460,7 @@ export interface OptionalObjectSchema< TContext extends AnyObject = AnyObject, TIn extends Maybe> = TypeOfShape > extends ObjectSchema { - default>>( + default>( def: TNextDefault | (() => TNextDefault), ): TNextDefault extends undefined ? ObjectSchema @@ -507,7 +507,7 @@ export interface DefinedObjectSchema< TIn, AssertsShape | Extract > { - default>>( + default>( def: TNextDefault | (() => TNextDefault), ): TNextDefault extends undefined ? DefinedObjectSchema @@ -548,7 +548,7 @@ export interface RequiredObjectSchema< TContext extends AnyObject, TIn extends Maybe> > extends ObjectSchema> { - default>>( + default>( def: TNextDefault | (() => TNextDefault), ): TNextDefault extends undefined ? RequiredObjectSchema diff --git a/src/schema.ts b/src/schema.ts index 69f50caca..7ffaccd91 100644 --- a/src/schema.ts +++ b/src/schema.ts @@ -25,7 +25,7 @@ import { } from './types'; import ValidationError from './ValidationError'; -import type { Asserts } from './util/types'; +import type { Asserts, Thunk } from './util/types'; import ReferenceSet from './util/ReferenceSet'; import Reference from './Reference'; @@ -489,9 +489,7 @@ export default abstract class BaseSchema< return schema._getDefault(); } - default>( - def: TNextDefault | (() => TNextDefault), - ): any { + default(def: Thunk): any { if (arguments.length === 0) { return this._getDefault(); }