Skip to content

t8js/unpack-schema

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unpack-schema

Define and extract Zod or Yup schema types without importing those packages

Use cases

  • Define types accepting schemas created with Zod or Yup in an abstract way without importing those packages (e.g. in an intermediary utility package).
  • Extract types from Zod/Yup schemas without importing .infer or InferType of those packages.
import type { Schema, UnpackedSchema } from "unpack-schema";

type CoordsSchema = Schema<{
  x: number;
  y: number;
}>;

type Coords = UnpackedSchema<CoordsSchema>;

About

Define and extract common schema types without importing their entire packages

Topics

Resources

License

Stars

Watchers

Forks