Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

unpack-schema

axtk350ISC1.2.2

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

schema, typed schema, inference, zod, yup

readme

unpack-schema

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:

import type {Schema} from 'unpack-schema';

type ParamsShape = Record<string, unknown>;
type Params = Schema<ParamsShape>;

🔹 Extract types from Zod/Yup schemas without importing .infer or InferType of those packages:

import type {UnpackedSchema} from 'unpack-schema';

function process(params: UnpackedSchema<Params, ParamsShape>) {
    // ...
}