-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Deno/Isolated Modules support, and GitHub Actions to test and fix #269
Conversation
https://www.typescriptlang.org/tsconfig#isolatedModules This is necessary (but not sufficient) to support Deno 1.5+. https://deno.land/posts/v1.5#stricter-type-checks-in-stable
This is because the /x/expect Deno library, which we'd like to use in place of Jest when testing on Deno, doesn't provide .toStrictEqual.
…int) if they weren't run locally.
… sufficient." This reverts commit 6050883.
I haven't tested it yet, but Deno appears to have merged a fix for the SWC bundler issue, so it should work in the next release. |
I merged this PR with a bunch of major structural changes from #226. Everything is now merged back into the v3 branch. I'm not sure how to verify that everything is still working as expected for Deno users. All the tests pass and everything compiles nicely with Testing the SWC bundler bug fix would also be great 👍 |
@colinhacks Great! I imported the v3 branch (https://raw.githubusercontent.com/colinhacks/zod/410dd7b479e6252656abc7c457585deac5b83ee4/deno/lib/mod.ts) into an existing project and was able to use it in a few places without encountering any errors; it looks good to me. 👍 Unfortunately, the Deno/SWC bundler is still broken. The previous error has been fixed, the output is now syntactically valid, but it's renaming exported types in an inconsistent way that creates reference errors. I'll file a new issue with Deno for the new error once I have a chance to reduce it. 🤞 |
Filed bundler bug at denoland/deno#8978. I'm not sure if my reduced case is the exact same root cause, but it's probably at least a nearby bug. |
Adds support for TypeScript's "isolated modules" mode, at the expense of bumping the minimum version for Zod v3 from TypeScript 3.7 to TypeScript 3.8. This changes type-only exports to use the
export type
keyword, and imports Jest's test helpers explicitly, so the TypeScript files can be compiled in isolation, instead of requiring shared context.Adds a GitHub Actions workflow to automatically regenerate
deno/lib
as well as run our other fixers (eslint and prettier) automatically if a commit is pushed without running them locally.Adds a GitHub Actions workflow to build and test again our maximum and minimum supported versions of TypeScript on Node, and also test on Deno.
This is still not compatible with
deno bundle
due to the bug denoland/deno#8680 (previously discussed around #209 (comment)). I experimented with changing export names to work around it, but the number of names that needed to be changed was significant, and the bundle still seemed to be invalid due to other errors, so I reverted those changes. For now we're only testing for compatibility with the primarydeno run
/deno install
workflow (only usingtsc
), not the less-stabledeno bundle
/deno compile
workflow (which uses bothtsc
andswc
).