Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

zod-class

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

zod-class - npm Package Compare versions

Comparing version 0.0.0 to 0.0.1

6

lib/cjs/index.d.ts
import { ZodObject, ZodRawShape, ZodType } from "zod";
type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
type ZodValue<T extends ZodType> = T extends ZodType<infer Output> ? UnionToIntersection<Output> : never;
export interface ZClass<T extends ZodRawShape> extends Omit<ZodObject<T>, "parse"> {
export interface ZodClass<T extends ZodRawShape> extends Omit<ZodObject<T>, "parse"> {
parse<T extends InstanceType<this> = InstanceType<this>>(value: unknown): T;

@@ -12,3 +12,3 @@ new (data: ZodValue<ZodObject<T>>): ZodValue<ZodObject<T>>;

* ```ts
* class HelloObject extends ZClass({
* class HelloObject extends ZodClass({
* key: z.string()

@@ -24,4 +24,4 @@ * }) { }

*/
export declare function ZClass<T extends ZodRawShape>(shape: T): ZClass<T>;
export declare function ZodClass<T extends ZodRawShape>(shape: T): ZodClass<T>;
export {};
//# sourceMappingURL=index.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ZClass = void 0;
exports.ZodClass = void 0;
const zod_1 = require("zod");

@@ -9,3 +9,3 @@ /**

* ```ts
* class HelloObject extends ZClass({
* class HelloObject extends ZodClass({
* key: z.string()

@@ -21,3 +21,3 @@ * }) { }

*/
function ZClass(shape) {
function ZodClass(shape) {
const schema = (0, zod_1.object)(shape);

@@ -30,3 +30,3 @@ return class {

}
exports.ZClass = ZClass;
exports.ZodClass = ZodClass;
//# sourceMappingURL=index.js.map
import { ZodObject, ZodRawShape, ZodType } from "zod";
type UnionToIntersection<T> = (T extends any ? (x: T) => any : never) extends (x: infer R) => any ? R : never;
type ZodValue<T extends ZodType> = T extends ZodType<infer Output> ? UnionToIntersection<Output> : never;
export interface ZClass<T extends ZodRawShape> extends Omit<ZodObject<T>, "parse"> {
export interface ZodClass<T extends ZodRawShape> extends Omit<ZodObject<T>, "parse"> {
parse<T extends InstanceType<this> = InstanceType<this>>(value: unknown): T;

@@ -12,3 +12,3 @@ new (data: ZodValue<ZodObject<T>>): ZodValue<ZodObject<T>>;

* ```ts
* class HelloObject extends ZClass({
* class HelloObject extends ZodClass({
* key: z.string()

@@ -24,4 +24,4 @@ * }) { }

*/
export declare function ZClass<T extends ZodRawShape>(shape: T): ZClass<T>;
export declare function ZodClass<T extends ZodRawShape>(shape: T): ZodClass<T>;
export {};
//# sourceMappingURL=index.d.ts.map

@@ -6,3 +6,3 @@ import { object } from "zod";

* ```ts
* class HelloObject extends ZClass({
* class HelloObject extends ZodClass({
* key: z.string()

@@ -18,3 +18,3 @@ * }) { }

*/
export function ZClass(shape) {
export function ZodClass(shape) {
const schema = object(shape);

@@ -21,0 +21,0 @@ return class {

{
"name": "zod-class",
"description": "Create classes from Zod Object schemas all in one line",
"version": "0.0.0",
"version": "0.0.1",
"exports": {

@@ -6,0 +6,0 @@ ".": {

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc