Repository: samchungy/zod-openapi (ts)

Issue:
`.openapi()` does not exist when extending zod with `extendZodWithOpenApi`
Since `4.2.1` (https://github.com/samchungy/zod-openapi/pull/393) the extended types are not being supplied when extending zod with `extendZodWithOpenApi`.

Downgrading to `4.2.0` fixes this issue.

Pull request description:
Fix Manual Type Extensions
Resolves #397

Patch:
diff --git a/src/create/schema/index.ts b/src/create/schema/index.ts
index 5f69f07..99046d4 100644
--- a/src/create/schema/index.ts
+++ b/src/create/schema/index.ts
@@ -1,6 +1,6 @@
 import type { ZodType, ZodTypeDef } from 'zod';
 
-import { currentSymbol, previousSymbol } from '../../extendZodTypes';
+import { currentSymbol, previousSymbol } from '../../extendZodSymbols';
 import type { oas30, oas31 } from '../../openapi3-ts/dist';
 import {
   type ComponentsObject,
diff --git a/src/entries/extend.ts b/src/entries/extend.ts
index ad509e9..fea7d7e 100644
--- a/src/entries/extend.ts
+++ b/src/entries/extend.ts
@@ -4,4 +4,5 @@ import { extendZodWithOpenApi } from '../extendZod';
 
 extendZodWithOpenApi(z);
 
+// eslint-disable-next-line @typescript-eslint/consistent-type-exports
 export * from '../extendZodTypes'; // compatibility with < TS 5.0 as the export type * syntax is not supported
diff --git a/src/extendZod.ts b/src/extendZod.ts
index 149daee..be8d77b 100644
--- a/src/extendZod.ts
+++ b/src/extendZod.ts
@@ -1,6 +1,7 @@
 import type { ZodRawShape, ZodTypeDef, z } from 'zod';
 
-import { currentSymbol, previousSymbol } from './extendZodTypes';
+import './extendZodTypes';
+import { currentSymbol, previousSymbol } from './extendZodSymbols';
 
 type ZodOpenApiMetadataDef = NonNullable<ZodTypeDef['zodOpenApi']>;
 type ZodOpenApiMetadata = ZodOpenApiMetadataDef['openapi'];
diff --git a/src/extendZodSymbols.ts b/src/extendZodSymbols.ts
new file mode 100644
index 0000000..c1f38dc
--- /dev/null
+++ b/src/extendZodSymbols.ts
@@ -0,0 +1,3 @@
+// TODO: Remove this file for TS 5.0
+export const currentSymbol = Symbol('current');
+export const previousSymbol = Symbol('previous');
diff --git a/src/extendZodTypes.ts b/src/extendZodTypes.ts
index c4ff49d..e844586 100644
--- a/src/extendZodTypes.ts
+++ b/src/extendZodTypes.ts
@@ -1,15 +1,13 @@
 import type { ZodObject, ZodTypeAny, z } from 'zod';
 
 import type { CreationType } from './create/components';
+import type { currentSymbol, previousSymbol } from './extendZodSymbols';
 import type { oas30, oas31 } from './openapi3-ts/dist';
 
 type SchemaObject = oas30.SchemaObject & oas31.SchemaObject;
 
 type ReplaceDate<T> = T extends Date ? Date | string : T;
 
-export const currentSymbol = Symbol('current');
-export const previousSymbol = Symbol('previous');
-
 /**
  * zod-openapi metadata
  */


Test patch:
diff --git a/src/extendZod.test.ts b/src/extendZod.test.ts
index 831ee36..185fdaa 100644
--- a/src/extendZod.test.ts
+++ b/src/extendZod.test.ts
@@ -2,7 +2,7 @@ import { z } from 'zod';
 
 import { createSchema } from './create/schema/single';
 import { extendZodWithOpenApi } from './extendZod';
-import { currentSymbol, previousSymbol } from './extendZodTypes';
+import { currentSymbol, previousSymbol } from './extendZodSymbols';
 
 extendZodWithOpenApi(z);