diff --git a/src/object.ts b/src/object.ts index 55204dd51..6429e2082 100644 --- a/src/object.ts +++ b/src/object.ts @@ -202,7 +202,7 @@ export default class ObjectSchema< fieldValue = !options.__validating || !strict ? // TODO: use _cast, this is double resolving - field.cast(value[prop], innerOptions) + (field as ISchema).cast(value[prop], innerOptions) : value[prop]; if (fieldValue !== undefined) { diff --git a/src/util/objectTypes.ts b/src/util/objectTypes.ts index 7943cf3b1..b1b9c53e4 100644 --- a/src/util/objectTypes.ts +++ b/src/util/objectTypes.ts @@ -6,8 +6,10 @@ export type ObjectShape = { [k: string]: ISchema | Reference }; export type AnyObject = { [k: string]: any }; -export type TypeFromShape = { - [K in keyof S]: S[K] extends ISchema ? S[K]['__outputType'] : unknown; +export type TypeFromShape = { + [K in keyof S]: S[K] extends ISchema + ? S[K]['__outputType'] + : unknown; }; export type DefaultFromShape = {