Comparing version 2.0.0-alpha.2 to 2.0.0-alpha.3
@@ -54,2 +54,3 @@ import { ParseParams } from '../parser'; | ||
refinement: (refinement: Check<Type>) => this; | ||
wrap: (value: Type, params?: ParseParams) => ZodValue<this>; | ||
constructor(def: Def); | ||
@@ -60,2 +61,7 @@ abstract toJSON: () => object; | ||
} | ||
export declare class ZodValue<S extends ZodType<any, any>> { | ||
value: S['_type']; | ||
schema: S; | ||
constructor(schema: S, value: S['_type']); | ||
} | ||
export {}; |
@@ -45,26 +45,2 @@ "use strict"; | ||
var ZodType = /** @class */ (function () { | ||
// mask = <P extends maskUtil.Params<Type>>(_params: P): ZodType<maskUtil.Pick<Type, P>> => { | ||
// return Masker(this, _params) as any; | ||
// }; | ||
// pick = <Params extends maskUtil.Params<Type>>(_params: Params): maskUtil.Mask<Type, Params> => { | ||
// return 'asdf' as any; | ||
// }; | ||
// Wrapper = class<Type, Schema> { | ||
// value: Type; | ||
// schema: Schema; | ||
// constructor(schema: Schema, value: Type) { | ||
// this.value = value; | ||
// this.schema = schema; | ||
// } | ||
// }; | ||
// wrap: (value: this['_type'], params?: ParseParams) => any = (value, params) => { | ||
// const parsed = this.parse(value, params); | ||
// return new this.Wrapper<this['_type'], this>(this, parsed); | ||
// // return new ZodValue(this, this.parse(value, params)); | ||
// }; | ||
// wrap: (value: Type, params?: ParseParams) => ZodValue<this> = (value, params) => { | ||
// const parsed = this.parse(value, params); | ||
// return new ZodValue(this, parsed); | ||
// // return new ZodValue(this, this.parse(value, params)); | ||
// }; | ||
function ZodType(def) { | ||
@@ -90,2 +66,26 @@ var _this = this; | ||
}; | ||
// mask = <P extends maskUtil.Params<Type>>(_params: P): ZodType<maskUtil.Pick<Type, P>> => { | ||
// return Masker(this, _params) as any; | ||
// }; | ||
// pick = <Params extends maskUtil.Params<Type>>(_params: Params): maskUtil.Mask<Type, Params> => { | ||
// return 'asdf' as any; | ||
// }; | ||
// Wrapper = class<Type, Schema> { | ||
// value: Type; | ||
// schema: Schema; | ||
// constructor(schema: Schema, value: Type) { | ||
// this.value = value; | ||
// this.schema = schema; | ||
// } | ||
// }; | ||
// wrap: (value: this['_type'], params?: ParseParams) => any = (value, params) => { | ||
// const parsed = this.parse(value, params); | ||
// return new this.Wrapper<this['_type'], this>(this, parsed); | ||
// // return new ZodValue(this, this.parse(value, params)); | ||
// }; | ||
this.wrap = function (value, params) { | ||
var parsed = _this.parse(value, params); | ||
return new ZodValue(_this, parsed); | ||
// return new ZodValue(this, this.parse(value, params)); | ||
}; | ||
this.parse = parser_1.ZodParser(def); | ||
@@ -115,10 +115,10 @@ this._def = def; | ||
exports.ZodType = ZodType; | ||
// export class ZodValue<S extends ZodType<any, any>> { | ||
// value: S['_type']; | ||
// schema: S; | ||
// constructor(schema: S, value: S['_type']) { | ||
// this.value = value; | ||
// this.schema = schema; | ||
// } | ||
// } | ||
var ZodValue = /** @class */ (function () { | ||
function ZodValue(schema, value) { | ||
this.value = value; | ||
this.schema = schema; | ||
} | ||
return ZodValue; | ||
}()); | ||
exports.ZodValue = ZodValue; | ||
//# sourceMappingURL=base.js.map |
{ | ||
"name": "zod", | ||
"version": "2.0.0-alpha.2", | ||
"version": "2.0.0-alpha.3", | ||
"description": "TypeScript-first schema declaration and validation library with static type inference", | ||
@@ -5,0 +5,0 @@ "main": "./lib/src/index.js", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
284766
4286