Skip to content
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

Performance Issue - Suggest typescript peer dependency #6

Closed
ferm10n opened this issue Feb 22, 2023 · 3 comments
Closed

Performance Issue - Suggest typescript peer dependency #6

ferm10n opened this issue Feb 22, 2023 · 3 comments

Comments

@ferm10n
Copy link

ferm10n commented Feb 22, 2023

Description

This problem made my development environment practically unusable until I was able to narrow it down to this package. Intellisense and tsserver updates would lag 9-16 seconds!

I'm not sure what exactly is the cause, but something about the d.ts files from parse-env don't play nice with typescript 4.4.3. Updating to 4.5 or newer fixed the issue.

I just started using this package and it seems really awesome. I just felt it was worth creating an issue for in case anyone else has similar problems. Hopefully I can spare someone else a headache or two.

Reproduction

I made a more tangible example of this with running tsc: https://stackblitz.com/edit/node-j7okci?file=README.md&view=editor

In this environment, I installed znv, typescript@4.4.3, and ran npx tsc and it takes 10s to build.
Running npm install typescript@~4.5 and npx tsc takes only 1s to build.

Suggestion

My recommendation for this project would be to specify a peerDependency for this project on typescript@^4.5. It won't force people to use that version, but some package managers (like yarn) will raise a warning... plus it should serve as an indicator for the minimum typescript version this project supports/recommends.

@lostfictions
Copy link
Owner

lostfictions commented Feb 23, 2023

Thanks for the report! That's unfortunate, I'm not too sure what's happening...

I'm not certain it would be a good idea to add a peerDependency on typescript@>=4.5, since then running npm/yarn/pnpm install with NODE_ENV set to production (or using the --production flag) would yield warnings or errors (or in npm's case might cause typescript to be erroneously installed).

It might be better to just document the performance degradation in the README instead. What do you think?

@lostfictions
Copy link
Owner

Hi there, looks like zod@3.20.2 (released in December) had introduced some perf issues that were only just fixed with the 3.21.0 release a few days ago. Any idea if this could be related to your performance issues?

@ferm10n
Copy link
Author

ferm10n commented Mar 7, 2023

Yeah that's definitely related. I forked the stackblitz repro I originally linked https://stackblitz.com/edit/node-cjrnba?file=README.md&view=editor there's notes in the README.md there, but it basically uses zod@3.21.0 with typescript@4.4 and the performance issues goes away.

So it seems that installing either typescript@^4.5 or zod@^3.21 fix the issue! Sounds like a case closed to me :)

@ferm10n ferm10n closed this as completed Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants