-
-
Notifications
You must be signed in to change notification settings - Fork 162
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support TS moduleResolution, NodeNext #460
Comments
See TS docs:
|
Note: your patch is actually wrong The correct patch should be: diff --git a/package.json b/package.json
index b46f9e11d988e11c89fbaf580e6bbc74502c6e7f..143135bd80304d991581643016799b0a0964c83b 100644
--- a/package.json
+++ b/package.json
@@ -16,8 +16,14 @@
},
"./zod": {
"umd": "./zod/dist/zod.umd.js",
- "import": "./zod/dist/zod.mjs",
- "require": "./zod/dist/zod.js"
+ "import": {
+ "types": "./zod/dist/index.d.ts",
+ "default": "./zod/dist/zod.mjs"
+ },
+ "require": {
+ "types": "./zod/dist/index.d.ts",
+ "default": "./zod/dist/zod.js"
+ }
},
"./yup": {
"umd": "./yup/dist/yup.umd.js",
diff --git a/zod/dist/index.d.ts b/zod/dist/index.d.ts
index 18dffb9fef1bf09e83d9ff5e3aec325cf562c780..b55eff2beb1311c50274f7040dd88102e5858faf 100644
--- a/zod/dist/index.d.ts
+++ b/zod/dist/index.d.ts
@@ -1,2 +1,2 @@
-export * from './zod';
-export * from './types';
+export * from './zod.js';
+export * from './types.js';
diff --git a/zod/dist/zod.d.ts b/zod/dist/zod.d.ts
index 839632e3d8495c00933dada6dd9f7a7d4003311a..3ad42563f00f8fb0a6d09c7234b66653b84561fe 100644
--- a/zod/dist/zod.d.ts
+++ b/zod/dist/zod.d.ts
@@ -1,2 +1,2 @@
-import type { Resolver } from './types';
+import type { Resolver } from './types.js';
export declare const zodResolver: Resolver; |
@Jack-Works, it works for me, but your suggestion looks more robust. Thank you! |
This error also shows up with TypeScript 5.0's |
Can you provide a repro example that I can clone? |
@jorisre, https://github.com/bestickley/rhf-zod-resolver-node-next-issue |
Ran into it this morning when we tried to switch to bundler. |
Thank you! I tried with a NextJs project as well. With(out) Now, I've to check the standard in order to open a PR on https://github.com/marvinhagemeister/check-export-map. If someone have link that document this pattern in package.json? |
I also tried with: "./zod": {
"umd": "./zod/dist/zod.umd.js",
"types": "./zod/dist/index.d.ts",
"import": "./zod/dist/zod.mjs",
"require": "./zod/dist/zod.js"
}, This is how Preact is doing. We'll probably do the same thing, so the |
Is your feature request related to a problem? Please describe.
I get the following TS error when trying to use @hookform/resolver/zod with TS moduleResolution, NodeNext:
Describe the solution you'd like
The following pnpm patch fixes this issue:
Describe alternatives you've considered
I think alternatively, if zod.d.ts contained the same content as index.d.ts, then this would work automatically without the change to the package.json
Additional context
None
The text was updated successfully, but these errors were encountered: