-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
fix: types #12
fix: types #12
Conversation
✅ Deploy Preview for valibot canceled.
|
The root types and main package entries updated for old TypeScript versions support: https://www.typescriptlang.org/docs/handbook/esm-node.html#packagejson-exports-imports-and-self-referencing |
Thanks for your research and technical implementation! What is the advantage of the submodules and the |
About submodules, here none. About d.cts and d.ts, you need to add both to allow use valibot in CJS and ESM, check typescriptlang link, TypeScript requires both. |
Do these files have to be in the |
Must be on root, ts resolution will lookup them for node10, dist folder will be regenerated on each build. Check the resolutions entries in https://arethetypeswrong.github.io/ with the tgz file, expand the details below the table |
Would we save all the hassle if we generated a single |
Yes, we only need the index.d.cts and the build.config.ts module, we can remove all the submodules, check first comment about removing submodules. I'll cleanup the PR tmr. |
This PR includes:
unbuild
dev dependency in library package.jsondts
file per submodule for node10: included indist
package entryIf you want to only export the index module:
d.ts
files from library folder, remove alsod.cts
ones, don't removeindex.d.cts
"."
)"resolveJsonModule": true
from library tsconfig file: only used to read the import entry from the package exportsbuild.config.ts
file, keep only the import and the default export usingdefineBuildConfig
(remove also the type from the import)entries
withentries: ['src/index'],
inbuild.config.ts
file*.d.ts
from library package.jsondist
option, don't remove*.d.cts
You can build and pack valibot:
pnpm build && pnpm pack
and upload generated tgz file to https://arethetypeswrong.github.io/closes #7