diff --git a/CHANGELOG.md b/CHANGELOG.md index 1570e865e..4371a32a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,16 @@ ## Version 10 +### v10.3.1 + +- Fixed issue of the insufficient exports of the proprietary schema definitions. + - The issue introduced in version 10.0.0-beta1 due to changing the compiler to `tsup`. + - The issue manifested only when `declaration` is enabled in your `tsconfig.json`. + - The issue caused following error: + - `TS4023: Exported variable '' has or is using name 'ZodFileDef' from external module "" but cannot be named.` + - The following interfaces are now available within the exported `ez` namespace: + - `ez.ZodFileDef`, `ez.ZodUploadDef`, `ez.ZodDateInDef`, `ez.ZodDateOutDef`. + ### v10.3.0 - Feature #945 for a client generator, proposed by [@McMerph](https://github.com/McMerph). diff --git a/src/ez-namespace.ts b/src/ez-namespace.ts deleted file mode 100644 index 204917dcd..000000000 --- a/src/ez-namespace.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ZodDateIn, ZodDateInDef } from "./date-in-schema"; -import { ZodDateOut, ZodDateOutDef } from "./date-out-schema"; -import { ZodFile, ZodFileDef } from "./file-schema"; -import { ZodUpload, ZodUploadDef } from "./upload-schema"; - -export namespace ez { - export const file = ZodFile.create; - export const upload = ZodUpload.create; - export const dateIn = ZodDateIn.create; - export const dateOut = ZodDateOut.create; -} - -export type ProprietaryKinds = - | ZodFileDef["typeName"] - | ZodUploadDef["typeName"] - | ZodDateInDef["typeName"] - | ZodDateOutDef["typeName"]; diff --git a/src/index.ts b/src/index.ts index 8a10130ac..54e248cf8 100644 --- a/src/index.ts +++ b/src/index.ts @@ -26,7 +26,7 @@ export { export { withMeta } from "./metadata"; export { testEndpoint } from "./mock"; export { Client } from "./client"; -export { ez } from "./ez-namespace"; +export * as ez from "./proprietary-schemas"; import createHttpError from "http-errors"; export { createHttpError }; diff --git a/src/proprietary-schemas.ts b/src/proprietary-schemas.ts new file mode 100644 index 000000000..d89b67189 --- /dev/null +++ b/src/proprietary-schemas.ts @@ -0,0 +1,14 @@ +import { ZodDateIn } from "./date-in-schema"; +import { ZodDateOut } from "./date-out-schema"; +import { ZodFile } from "./file-schema"; +import { ZodUpload } from "./upload-schema"; + +export type { ZodDateInDef } from "./date-in-schema"; +export type { ZodDateOutDef } from "./date-out-schema"; +export type { ZodFileDef } from "./file-schema"; +export type { ZodUploadDef } from "./upload-schema"; + +export const file = ZodFile.create; +export const upload = ZodUpload.create; +export const dateIn = ZodDateIn.create; +export const dateOut = ZodDateOut.create; diff --git a/src/schema-walker.ts b/src/schema-walker.ts index be9fc73a3..6e0cb0f75 100644 --- a/src/schema-walker.ts +++ b/src/schema-walker.ts @@ -1,5 +1,10 @@ import { z } from "zod"; -import { ProprietaryKinds } from "./ez-namespace"; +import { + ZodDateInDef, + ZodDateOutDef, + ZodFileDef, + ZodUploadDef, +} from "./proprietary-schemas"; export type HandlingVariant = "last" | "regular" | "each"; @@ -29,6 +34,12 @@ export type SchemaHandler< Variant extends HandlingVariant = "regular" > = (params: SchemaHandlingProps) => U; +export type ProprietaryKinds = + | ZodFileDef["typeName"] + | ZodUploadDef["typeName"] + | ZodDateInDef["typeName"] + | ZodDateOutDef["typeName"]; + export type HandlingRules = Partial< Record< z.ZodFirstPartyTypeKind | ProprietaryKinds,