Comparing version 1.5.0 to 1.5.1
@@ -0,2 +1,6 @@ | ||
declare const typeErrSym: unique symbol; | ||
declare const coercionTypeSymbol: unique symbol; | ||
export declare abstract class Type<T> { | ||
[typeErrSym]?: string | (() => string); | ||
[coercionTypeSymbol]?: boolean; | ||
constructor(); | ||
@@ -21,10 +25,7 @@ abstract parse(value: unknown): T; | ||
} | ||
export declare type Eval<T> = T extends any[] | Date | unknown ? T : { | ||
[Key in keyof T]: T[Key]; | ||
} & {}; | ||
export declare type Eval<T> = T extends any[] | Date | unknown ? T : Flat<T>; | ||
export declare type AnyType = Type<any>; | ||
export declare type Infer<T> = T extends AnyType ? (T extends Type<infer K> ? Eval<K> : any) : T; | ||
export declare type Infer<T> = T extends AnyType ? (T extends Type<infer K> ? K : any) : T; | ||
declare const allowUnknownSymbol: unique symbol; | ||
declare const shapekeysSymbol: unique symbol; | ||
export declare const coercionTypeSymbol: unique symbol; | ||
export declare type IntersectionResult<T extends AnyType, K extends AnyType> = T extends ObjectType<any> ? K extends ObjectType<any> ? T extends ObjectType<infer Shape1> ? K extends ObjectType<infer Shape2> ? ObjectType<Eval<MergeShapes<Shape1, Shape2>>> : never : never : IntersectionType<T, K> : T extends ArrayType<any> ? K extends ArrayType<any> ? T extends ArrayType<infer S1> ? K extends ArrayType<infer S2> ? ArrayType<IntersectionResult<S1, S2>> : never : never : IntersectionType<T, K> : T extends TupleType<any> ? K extends TupleType<any> ? T extends TupleType<infer S1> ? K extends TupleType<infer S2> ? TupleType<Join<S1, S2>> : never : never : IntersectionType<T, K> : IntersectionType<T, K>; | ||
@@ -217,5 +218,7 @@ declare type ErrMsg<T> = string | ((value: T) => string); | ||
private shouldCollectErrors; | ||
private _parse; | ||
constructor(objectShape: T, opts?: ObjectOptions<T>); | ||
parse(value?: unknown, parseOpts?: ObjectOptions<any> & PathOptions): InferObjectShape<T>; | ||
private buildPathError; | ||
private selectParser; | ||
private parseObject; | ||
@@ -236,3 +239,3 @@ private parseObjectCollect; | ||
[keySignature]: AnyType; | ||
} ? string : StringTypes<keyof T>>(keys: K[], opts?: ObjectOptions<Eval<Pick<T, Extract<StringTypes<keyof T>, ToUnion<typeof keys>>> & (T extends { | ||
} ? string : StringTypes<keyof T>>(keys: K[], opts?: ObjectOptions<Flat<Pick<T, Extract<StringTypes<keyof T>, ToUnion<typeof keys>>> & (T extends { | ||
[keySignature]: AnyType; | ||
@@ -243,3 +246,3 @@ } ? T extends { | ||
[key in Exclude<ToUnion<typeof keys>, keyof T>]: KeySig; | ||
} : {} : {})>>): ObjectType<Eval<Pick<T, Extract<StringTypes<keyof T>, ToUnion<typeof keys>>> & (T extends { | ||
} : {} : {})>>): ObjectType<Flat<Pick<T, Extract<StringTypes<keyof T>, ToUnion<typeof keys>>> & (T extends { | ||
[keySignature]: AnyType; | ||
@@ -251,6 +254,6 @@ } ? T extends { | ||
} : {} : {})>>; | ||
omit<K extends StringTypes<keyof T>>(keys: K[], opts?: ObjectOptions<Eval<Omit<T, ToUnion<typeof keys>>>>): ObjectType<Eval<Omit<T, ToUnion<typeof keys>>>>; | ||
omit<K extends StringTypes<keyof T>>(keys: K[], opts?: ObjectOptions<Eval<Omit<T, ToUnion<typeof keys>>>>): ObjectType<Flat<Omit<T, ToUnion<typeof keys>>>>; | ||
partial<K extends ObjectOptions<Eval<DeepPartialShape<T>>> & { | ||
deep: true; | ||
}>(opts: K): ObjectType<Eval<DeepPartialShape<T>>>; | ||
}>(opts: K): ObjectType<Flat<DeepPartialShape<T>>>; | ||
partial<K extends ObjectOptions<Eval<PartialShape<T>>> & PartialOpts>(opts?: K): ObjectType<Eval<PartialShape<T>>>; | ||
@@ -257,0 +260,0 @@ shape(): T; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.LazyType = exports.PartialType = exports.EnumType = exports.IntersectionType = exports.UnionType = exports.TupleType = exports.ArrayType = exports.ObjectType = exports.keySignature = exports.DateType = exports.NullableType = exports.OptionalType = exports.UnknownType = exports.LiteralType = exports.NullType = exports.UndefinedType = exports.BigIntType = exports.NumberType = exports.BooleanType = exports.StringType = exports.coercionTypeSymbol = exports.ValidationError = exports.Type = void 0; | ||
exports.LazyType = exports.PartialType = exports.EnumType = exports.IntersectionType = exports.UnionType = exports.TupleType = exports.ArrayType = exports.ObjectType = exports.keySignature = exports.DateType = exports.NullableType = exports.OptionalType = exports.UnknownType = exports.LiteralType = exports.NullType = exports.UndefinedType = exports.BigIntType = exports.NumberType = exports.BooleanType = exports.StringType = exports.ValidationError = exports.Type = void 0; | ||
const util_1 = require("util"); | ||
@@ -22,3 +22,4 @@ function clone(value) { | ||
} | ||
const typeErrSym = Symbol.for('typeError'); | ||
const typeErrSym = Symbol('typeError'); | ||
const coercionTypeSymbol = Symbol('coercion'); | ||
class Type { | ||
@@ -53,3 +54,3 @@ constructor() { } | ||
cpy.parse = (value) => fn(parse(value)); | ||
cpy[exports.coercionTypeSymbol] = true; | ||
cpy[coercionTypeSymbol] = true; | ||
return cpy; | ||
@@ -115,5 +116,4 @@ } | ||
} | ||
const allowUnknownSymbol = Symbol.for('allowUnknown'); | ||
const shapekeysSymbol = Symbol.for('shapeKeys'); | ||
exports.coercionTypeSymbol = Symbol.for('coercion'); | ||
const allowUnknownSymbol = Symbol('allowUnknown'); | ||
const shapekeysSymbol = Symbol('shapeKeys'); | ||
const normalizePredicates = (predicate) => { | ||
@@ -163,3 +163,3 @@ if (!predicate) { | ||
const cpy = clone(schema); | ||
cpy[exports.coercionTypeSymbol] = true; | ||
cpy[coercionTypeSymbol] = true; | ||
cpy.defaultValue = value; | ||
@@ -173,3 +173,3 @@ return cpy; | ||
this.defaultValue = opts === null || opts === void 0 ? void 0 : opts.default; | ||
this[exports.coercionTypeSymbol] = (opts === null || opts === void 0 ? void 0 : opts.default) !== undefined; | ||
this[coercionTypeSymbol] = (opts === null || opts === void 0 ? void 0 : opts.default) !== undefined; | ||
let self = this; | ||
@@ -228,3 +228,3 @@ if (typeof (opts === null || opts === void 0 ? void 0 : opts.min) !== 'undefined') { | ||
this.defaultValue = defaultValue; | ||
this[exports.coercionTypeSymbol] = defaultValue !== undefined; | ||
this[coercionTypeSymbol] = defaultValue !== undefined; | ||
} | ||
@@ -251,3 +251,3 @@ parse(value = typeof this.defaultValue === 'function' ? this.defaultValue() : this.defaultValue) { | ||
this.defaultValue = opts.default; | ||
this[exports.coercionTypeSymbol] = !!opts.coerce || opts.default !== undefined; | ||
this[coercionTypeSymbol] = !!opts.coerce || opts.default !== undefined; | ||
let self = this; | ||
@@ -305,3 +305,3 @@ if (typeof opts.max !== 'undefined') { | ||
super(); | ||
this[exports.coercionTypeSymbol] = true; | ||
this[coercionTypeSymbol] = true; | ||
this.predicates = normalizePredicates(opts.predicate); | ||
@@ -411,3 +411,3 @@ this.defaultValue = opts.default; | ||
this.schema = schema; | ||
this[exports.coercionTypeSymbol] = this.schema[exports.coercionTypeSymbol]; | ||
this[coercionTypeSymbol] = this.schema[coercionTypeSymbol]; | ||
this[shapekeysSymbol] = this.schema[shapekeysSymbol]; | ||
@@ -432,3 +432,3 @@ this[allowUnknownSymbol] = this.schema[allowUnknownSymbol]; | ||
this.schema = schema; | ||
this[exports.coercionTypeSymbol] = this.schema[exports.coercionTypeSymbol]; | ||
this[coercionTypeSymbol] = this.schema[coercionTypeSymbol]; | ||
this[shapekeysSymbol] = this.schema[shapekeysSymbol]; | ||
@@ -456,3 +456,3 @@ this[allowUnknownSymbol] = this.schema[allowUnknownSymbol]; | ||
super(); | ||
this[exports.coercionTypeSymbol] = true; | ||
this[coercionTypeSymbol] = true; | ||
this.predicates = normalizePredicates(opts === null || opts === void 0 ? void 0 : opts.predicate); | ||
@@ -492,3 +492,3 @@ this.defaultValue = opts === null || opts === void 0 ? void 0 : opts.default; | ||
exports.DateType = DateType; | ||
exports.keySignature = Symbol.for('keySignature'); | ||
exports.keySignature = Symbol('keySignature'); | ||
class ObjectType extends Type { | ||
@@ -505,22 +505,16 @@ constructor(objectShape, opts) { | ||
this[shapekeysSymbol] = keys; | ||
this[exports.coercionTypeSymbol] = | ||
this[coercionTypeSymbol] = | ||
this.defaultValue !== undefined || | ||
this[allowUnknownSymbol] || | ||
Object.values(this.objectShape).some(schema => schema[exports.coercionTypeSymbol]) || | ||
!!(this.objectShape[exports.keySignature] && this.objectShape[exports.keySignature][exports.coercionTypeSymbol]); | ||
Object.values(this.objectShape).some(schema => schema[coercionTypeSymbol]) || | ||
!!(this.objectShape[exports.keySignature] && this.objectShape[exports.keySignature][coercionTypeSymbol]); | ||
this._parse = this.selectParser(); | ||
} | ||
parse(value = typeof this.defaultValue === 'function' ? this.defaultValue() : this.defaultValue, parseOpts = {}) { | ||
if (typeof value !== 'object') { | ||
if (typeof value !== 'object' || value === null || Array.isArray(value)) { | ||
throw this.typeError('expected type to be object but got ' + typeOf(value)); | ||
} | ||
if (value === null) { | ||
throw this.typeError('expected object but got null'); | ||
} | ||
if (Array.isArray(value)) { | ||
throw this.typeError('expected type to be regular object but got array'); | ||
} | ||
const keys = this[shapekeysSymbol]; | ||
const allowUnknown = parseOpts.allowUnknown || this[allowUnknownSymbol]; | ||
const keySig = this.objectShape[exports.keySignature]; | ||
if (!allowUnknown && !keySig) { | ||
if (!allowUnknown && !this.objectShape[exports.keySignature]) { | ||
const illegalKeys = []; | ||
@@ -536,47 +530,49 @@ for (const k in value) { | ||
} | ||
if (keys.length === 0 && keySig) { | ||
if (this[exports.coercionTypeSymbol] && this.shouldCollectErrors) { | ||
return this.parseRecordConvCollect(value, keySig); | ||
return this._parse(value, parseOpts); | ||
} | ||
buildPathError(err, key, parseOpts) { | ||
const path = err.path ? [key, ...err.path] : [key]; | ||
const msg = parseOpts.suppressPathErrMsg | ||
? err.message | ||
: `error parsing object at path: "${prettyPrintPath(path)}" - ${err.message}`; | ||
return new ValidationError(msg, path); | ||
} | ||
selectParser() { | ||
if (this[shapekeysSymbol].length === 0 && this[exports.keySignature]) { | ||
if (this[coercionTypeSymbol] && this.shouldCollectErrors) { | ||
return this.parseRecordConvCollect; | ||
} | ||
else if (this[exports.coercionTypeSymbol]) { | ||
return this.parseRecordConv(value, keySig, parseOpts); | ||
if (this[coercionTypeSymbol]) { | ||
return this.parseRecordConv; | ||
} | ||
else if (this.shouldCollectErrors) { | ||
return this.parseRecordCollect(value, keySig); | ||
if (this.shouldCollectErrors) { | ||
return this.parseRecordCollect; | ||
} | ||
return this.parseRecord(value, keySig, parseOpts); | ||
return this.parseRecord; | ||
} | ||
if (keySig) { | ||
if (this[exports.coercionTypeSymbol] && this.shouldCollectErrors) { | ||
return this.parseMixRecordConvCollect(value, keys, keySig); | ||
if (this[exports.keySignature]) { | ||
if (this[coercionTypeSymbol] && this.shouldCollectErrors) { | ||
return this.parseMixRecordConvCollect; | ||
} | ||
else if (this[exports.coercionTypeSymbol]) { | ||
return this.parseMixRecordConv(value, keys, keySig, parseOpts); | ||
if (this[coercionTypeSymbol]) { | ||
return this.parseMixRecordConv; | ||
} | ||
else if (this.shouldCollectErrors) { | ||
return this.parseMixRecordCollect(value, keys, keySig); | ||
if (this.shouldCollectErrors) { | ||
return this.parseMixRecordCollect; | ||
} | ||
return this.parseMixRecord(value, keys, keySig, parseOpts); | ||
return this.parseMixRecord; | ||
} | ||
if (this[exports.coercionTypeSymbol] && this.shouldCollectErrors) { | ||
return this.parseObjectConvCollect(value, keys); | ||
if (this[coercionTypeSymbol] && this.shouldCollectErrors) { | ||
return this.parseObjectConvCollect; | ||
} | ||
else if (this[exports.coercionTypeSymbol]) { | ||
parseOpts; | ||
return this.parseObjectConv(value, keys, parseOpts); | ||
if (this[coercionTypeSymbol]) { | ||
return this.parseObjectConv; | ||
} | ||
else if (this.shouldCollectErrors) { | ||
return this.parseObjectCollect(value, keys); | ||
if (this.shouldCollectErrors) { | ||
return this.parseObjectCollect; | ||
} | ||
return this.parseObject(value, keys, parseOpts); | ||
return this.parseObject; | ||
} | ||
buildPathError(err, key, parseOpts) { | ||
const path = err.path ? [key, ...err.path] : [key]; | ||
const msg = parseOpts.suppressPathErrMsg | ||
? err.message | ||
: `error parsing object at path: "${prettyPrintPath(path)}" - ${err.message}`; | ||
return new ValidationError(msg, path); | ||
} | ||
parseObject(value, keys, parseOpts) { | ||
for (const key of keys) { | ||
parseObject(value, parseOpts) { | ||
for (const key of this[shapekeysSymbol]) { | ||
try { | ||
@@ -598,6 +594,6 @@ const schema = this.objectShape[key]; | ||
} | ||
parseObjectCollect(value, keys) { | ||
parseObjectCollect(value, parseOpts) { | ||
let hasError = false; | ||
const errs = {}; | ||
for (const key of keys) { | ||
for (const key of this[shapekeysSymbol]) { | ||
const schema = this.objectShape[key]; | ||
@@ -623,5 +619,5 @@ if (schema instanceof UnknownType && !value.hasOwnProperty(key)) { | ||
} | ||
parseObjectConv(value, keys, parseOpts) { | ||
parseObjectConv(value, parseOpts) { | ||
const convVal = {}; | ||
for (const key of keys) { | ||
for (const key of this[shapekeysSymbol]) { | ||
try { | ||
@@ -643,7 +639,7 @@ const schema = this.objectShape[key]; | ||
} | ||
parseObjectConvCollect(value, keys) { | ||
parseObjectConvCollect(value, parseOpts) { | ||
const convVal = {}; | ||
const errs = {}; | ||
let hasError = false; | ||
for (const key of keys) { | ||
for (const key of this[shapekeysSymbol]) { | ||
const schema = this.objectShape[key]; | ||
@@ -672,6 +668,6 @@ if (schema instanceof UnknownType && !value.hasOwnProperty(key)) { | ||
} | ||
parseRecord(value, keySig, parseOpts) { | ||
parseRecord(value, parseOpts) { | ||
for (const key in value) { | ||
try { | ||
keySig.parse(value[key], { suppressPathErrMsg: true }); | ||
this[exports.keySignature].parse(value[key], { suppressPathErrMsg: true }); | ||
} | ||
@@ -687,7 +683,7 @@ catch (err) { | ||
} | ||
parseRecordCollect(value, keySig) { | ||
parseRecordCollect(value, parseOpts) { | ||
let hasError = false; | ||
const errs = {}; | ||
for (const key in value) { | ||
const result = keySig.try(value[key], { suppressPathErrMsg: true }); | ||
const result = this[exports.keySignature].try(value[key], { suppressPathErrMsg: true }); | ||
if (result instanceof ValidationError) { | ||
@@ -706,7 +702,7 @@ hasError = true; | ||
} | ||
parseRecordConv(value, keySig, parseOpts) { | ||
parseRecordConv(value, parseOpts) { | ||
const convVal = {}; | ||
for (const key in value) { | ||
try { | ||
convVal[key] = keySig.parse(value[key], { suppressPathErrMsg: true }); | ||
convVal[key] = this[exports.keySignature].parse(value[key], { suppressPathErrMsg: true }); | ||
} | ||
@@ -722,3 +718,3 @@ catch (err) { | ||
} | ||
parseRecordConvCollect(value, keySig) { | ||
parseRecordConvCollect(value, parseOpts) { | ||
const convVal = {}; | ||
@@ -728,3 +724,3 @@ const errs = {}; | ||
for (const key in value) { | ||
const result = keySig.try(value[key], { suppressPathErrMsg: true }); | ||
const result = this[exports.keySignature].try(value[key], { suppressPathErrMsg: true }); | ||
if (result instanceof ValidationError) { | ||
@@ -746,6 +742,6 @@ hasError = true; | ||
} | ||
parseMixRecord(value, keys, keySig, parseOpts) { | ||
for (const key of new Set(Object.keys(value).concat(keys))) { | ||
parseMixRecord(value, parseOpts) { | ||
for (const key of new Set(Object.keys(value).concat(this[shapekeysSymbol]))) { | ||
try { | ||
(this.objectShape[key] || keySig).parse(value[key], { suppressPathErrMsg: true }); | ||
(this.objectShape[key] || this[exports.keySignature]).parse(value[key], { suppressPathErrMsg: true }); | ||
} | ||
@@ -761,7 +757,7 @@ catch (err) { | ||
} | ||
parseMixRecordCollect(value, keys, keySig) { | ||
parseMixRecordCollect(value, parseOpts) { | ||
let hasError = false; | ||
const errs = {}; | ||
for (const key of new Set(Object.keys(value).concat(keys))) { | ||
const result = (this.objectShape[key] || keySig).try(value[key], { | ||
for (const key of new Set(Object.keys(value).concat(this[shapekeysSymbol]))) { | ||
const result = (this.objectShape[key] || this[exports.keySignature]).try(value[key], { | ||
suppressPathErrMsg: true, | ||
@@ -782,7 +778,7 @@ }); | ||
} | ||
parseMixRecordConv(value, keys, keySig, parseOpts) { | ||
parseMixRecordConv(value, parseOpts) { | ||
const convVal = {}; | ||
for (const key of new Set(Object.keys(value).concat(keys))) { | ||
for (const key of new Set(Object.keys(value).concat(this[shapekeysSymbol]))) { | ||
try { | ||
convVal[key] = (this.objectShape[key] || keySig).parse(value[key], { | ||
convVal[key] = (this.objectShape[key] || this[exports.keySignature]).parse(value[key], { | ||
suppressPathErrMsg: true, | ||
@@ -800,8 +796,8 @@ }); | ||
} | ||
parseMixRecordConvCollect(value, keys, keySig) { | ||
parseMixRecordConvCollect(value, parseOpts) { | ||
const convVal = {}; | ||
const errs = {}; | ||
let hasError = false; | ||
for (const key of new Set(Object.keys(value).concat(keys))) { | ||
const result = (this.objectShape[key] || keySig).try(value[key], { | ||
for (const key of new Set(Object.keys(value).concat(this[shapekeysSymbol]))) { | ||
const result = (this.objectShape[key] || this[exports.keySignature]).try(value[key], { | ||
suppressPathErrMsg: true, | ||
@@ -898,3 +894,5 @@ }); | ||
default(value) { | ||
return withDefault(this, value); | ||
const cpy = withDefault(this, value); | ||
cpy._parse = cpy.selectParser(); | ||
return cpy; | ||
} | ||
@@ -904,2 +902,3 @@ collectErrors(value = true) { | ||
cpy.shouldCollectErrors = value; | ||
cpy._parse = cpy.selectParser(); | ||
return cpy; | ||
@@ -910,3 +909,4 @@ } | ||
cpy[allowUnknownSymbol] = value; | ||
cpy[exports.coercionTypeSymbol] = cpy[exports.coercionTypeSymbol] || value; | ||
cpy[coercionTypeSymbol] = cpy[coercionTypeSymbol] || value; | ||
cpy._parse = cpy.selectParser(); | ||
return cpy; | ||
@@ -923,6 +923,6 @@ } | ||
this.coerceFn = opts.coerce; | ||
this[exports.coercionTypeSymbol] = | ||
this[coercionTypeSymbol] = | ||
typeof this.coerceFn === 'function' || | ||
this.defaultValue !== undefined || | ||
this.schema[exports.coercionTypeSymbol]; | ||
this.schema[coercionTypeSymbol]; | ||
this._parse = | ||
@@ -965,3 +965,3 @@ this.schema instanceof ObjectType || this.schema instanceof ArrayType || this.schema instanceof LazyType | ||
} | ||
const convValue = this[exports.coercionTypeSymbol] ? [] : undefined; | ||
const convValue = this[coercionTypeSymbol] ? [] : undefined; | ||
for (let i = 0; i < value.length; i++) { | ||
@@ -1038,4 +1038,4 @@ try { | ||
this.defaultValue = opts === null || opts === void 0 ? void 0 : opts.default; | ||
this[exports.coercionTypeSymbol] = | ||
this.defaultValue !== undefined || schemas.some(schema => schema[exports.coercionTypeSymbol]); | ||
this[coercionTypeSymbol] = | ||
this.defaultValue !== undefined || schemas.some(schema => schema[coercionTypeSymbol]); | ||
} | ||
@@ -1049,3 +1049,3 @@ parse(value = typeof this.defaultValue === 'function' ? this.defaultValue() : this.defaultValue) { | ||
} | ||
const convValue = this[exports.coercionTypeSymbol] ? [] : undefined; | ||
const convValue = this[coercionTypeSymbol] ? [] : undefined; | ||
for (let i = 0; i < this.schemas.length; i++) { | ||
@@ -1104,4 +1104,4 @@ try { | ||
this.defaultValue = opts === null || opts === void 0 ? void 0 : opts.default; | ||
this[exports.coercionTypeSymbol] = | ||
(opts === null || opts === void 0 ? void 0 : opts.default) !== undefined || schemas.some(schema => schema[exports.coercionTypeSymbol]); | ||
this[coercionTypeSymbol] = | ||
(opts === null || opts === void 0 ? void 0 : opts.default) !== undefined || schemas.some(schema => schema[coercionTypeSymbol]); | ||
} | ||
@@ -1143,4 +1143,4 @@ parse( | ||
this.right = right; | ||
this[exports.coercionTypeSymbol] = | ||
this.left[exports.coercionTypeSymbol] || this.right[exports.coercionTypeSymbol]; | ||
this[coercionTypeSymbol] = | ||
this.left[coercionTypeSymbol] || this.right[coercionTypeSymbol]; | ||
this[allowUnknownSymbol] = !!(this.left[allowUnknownSymbol] || this.right[allowUnknownSymbol]); | ||
@@ -1199,3 +1199,3 @@ if (this.left[shapekeysSymbol] && this.right[shapekeysSymbol]) { | ||
this.defaultValue = opts.defaultValue; | ||
this[exports.coercionTypeSymbol] = this.defaultValue !== undefined; | ||
this[coercionTypeSymbol] = this.defaultValue !== undefined; | ||
} | ||
@@ -1253,3 +1253,3 @@ parse( | ||
this.schema = toPartialSchema(schema, opts); | ||
this[exports.coercionTypeSymbol] = this.schema[exports.coercionTypeSymbol]; | ||
this[coercionTypeSymbol] = this.schema[coercionTypeSymbol]; | ||
} | ||
@@ -1269,3 +1269,3 @@ parse(value) { | ||
// Since we can't know what the schema is we can't assume its not a coercionType and we need to disable the optimization | ||
this[exports.coercionTypeSymbol] = true; | ||
this[coercionTypeSymbol] = true; | ||
} | ||
@@ -1272,0 +1272,0 @@ parse(value, opts) { |
{ | ||
"name": "myzod", | ||
"version": "1.5.0", | ||
"version": "1.5.1", | ||
"description": "", | ||
@@ -36,3 +36,3 @@ "main": "./libs/index.js", | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.2.2" | ||
"typescript": "^4.2.3" | ||
}, | ||
@@ -39,0 +39,0 @@ "nyc": { |
1799
104074