Define and extract Zod or Yup schema types without importing those packages
- 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
.inferorInferTypeof those packages.
import type { Schema, UnpackedSchema } from "unpack-schema";
type CoordsSchema = Schema<{
x: number;
y: number;
}>;
type Coords = UnpackedSchema<CoordsSchema>;