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(); }