Skip to content

Commit

Permalink
fix(types): change base.default() to any
Browse files Browse the repository at this point in the history
  • Loading branch information
jquense committed Dec 7, 2020
1 parent 01d50ce commit 01c6930
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
6 changes: 3 additions & 3 deletions src/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,7 @@ export interface OptionalObjectSchema<
TContext extends AnyObject = AnyObject,
TIn extends Maybe<TypeOfShape<TShape>> = TypeOfShape<TShape>
> extends ObjectSchema<TShape, TContext, TIn> {
default<TNextDefault extends Maybe<Record<string, any>>>(
default<TNextDefault extends Maybe<AnyObject>>(
def: TNextDefault | (() => TNextDefault),
): TNextDefault extends undefined
? ObjectSchema<TShape, TContext, TIn | undefined>
Expand Down Expand Up @@ -507,7 +507,7 @@ export interface DefinedObjectSchema<
TIn,
AssertsShape<TShape> | Extract<TIn, null>
> {
default<TNextDefault extends Maybe<Record<string, any>>>(
default<TNextDefault extends Maybe<AnyObject>>(
def: TNextDefault | (() => TNextDefault),
): TNextDefault extends undefined
? DefinedObjectSchema<TShape, TContext, TIn | undefined>
Expand Down Expand Up @@ -548,7 +548,7 @@ export interface RequiredObjectSchema<
TContext extends AnyObject,
TIn extends Maybe<TypeOfShape<TShape>>
> extends ObjectSchema<TShape, TContext, TIn, AssertsShape<TShape>> {
default<TNextDefault extends Maybe<Record<string, any>>>(
default<TNextDefault extends Maybe<AnyObject>>(
def: TNextDefault | (() => TNextDefault),
): TNextDefault extends undefined
? RequiredObjectSchema<TShape, TContext, TIn | undefined>
Expand Down
6 changes: 2 additions & 4 deletions src/schema.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -489,9 +489,7 @@ export default abstract class BaseSchema<
return schema._getDefault();
}

default<TNextDefault extends Maybe<TCast>>(
def: TNextDefault | (() => TNextDefault),
): any {
default(def: Thunk<any>): any {
if (arguments.length === 0) {
return this._getDefault();
}
Expand Down

0 comments on commit 01c6930

Please sign in to comment.