r/typescript • u/DanielRosenwasser • 1d ago
Announcing TypeScript 7.1 RC
https://devblogs.microsoft.com/typescript/announcing-typescript-7-1-rc/?r10
4
-24
u/strettist 1d ago
I just wish we could use TypeScript 7.0. No yarn PnP support means we’re stuck on 6.
38
u/EarlMarshal 1d ago
But isn't that a yarn problem?
1
u/strettist 1d ago
To an extent, but the community has been trying to provide a solution to this problem for a while, but the TS maintainers haven’t been hospitable to the efforts.
12
2
u/epukinsk 1d ago
I don’t know if I would say they’ve been inhospitable. They’ve provided feedback on the MRs, and a pretty transparent explanation for why they aren’t ready to do it: https://github.com/microsoft/TypeScript/pull/63919#issuecomment-5898089808
I love Yarn PnP, but it isn’t a standard yet.
I can understand why the TypeScript folks would drag their feet on this.
It seems like the path forward is package maps, right? It feels like if someone can put together a clean PR for that, there’s a good chance the TS folks would help get it merged.
1
u/Chenipan 5h ago
PnP is shit because it requires the ecosystem to adapt to it instead of adapting itself to the ecosystem.
Just use pnpm
12
u/coolcosmos 1d ago
Yarn PnP is the worst thing in the JS ecosystem. It's juste the worst hack imaginable.
2
u/epukinsk 1d ago
CI jobs that run in seconds instead of minutes is kind of amazing.
The amount of totally inert bytes in a node_modules folder that have to be loaded and unloaded hundreds of times a day is kind of insane. PnP is the only tech I’m aware of that solves that. Deno too I guess?
22
u/jessepence 1d ago
Why in God's name are you still using Yarn!? How hard could it be to migrate off of it?
3
u/strettist 1d ago
Because Yarn has certain features that don’t exist in things like pnpm, and those features are quite valuable, especially for very large codebases.
3
u/x0wl 1d ago
Because Yarn PnP (and its local cache capability in general) is great in a lot of scenarios, like hermetic builds. I don't like the constant reliance on NPM being up all the time. If you know of a solution where you can commit your package cache to git without any issues, please let me know, as I was unable to find one neither manually nor with AI help.
The best solution for me as of now is to use Yarn with committed cache and pnpm linker setting, and putting the install command in a git hook.
9
u/Baxxterhv 1d ago
pnpm + ci cache
2
u/epukinsk 1d ago
CI cache still takes like a minute to load, repeated over every single CI job. Hundreds of times a day, maybe thousands for a big team, copying the same 99% unused data onto the filesystem.
PnP is an order of magnitude faster.
1
u/x0wl 1d ago
Can you distribute this cache (for example, to people who cannot access npm)? The task here is that a collaborator stranded on an island with only a laptop with Linux, Node and your git repo should be able to build, run and develop your project.
I can quite easily do it with Yarn (even without pnp, it's more of a convenience feature).
2
u/Baxxterhv 1d ago
if you really need it, yes, you can totally do that with pnpm too with a couple extra steps, you just dont commit the raw store to git. you run pnpm fetch --store-dir=./.pnpm-store, tar that folder up and send it over as a release artifact or whatever. then on the offline machine they just extract it and run pnpm install --offline --store-dir=./.pnpm-store
it still has the exact same caveats as yarn though (matching os/cpu archs, postinstall scripts downloading binaries, matching pnpm versions etc) except your git history stays clean
that "stranded on an island" thing only works if your project is 100% pure js. in reality your island guy is gonna have a bad time, if you built that cache on mac or windows his linux machine wont have the right native binaries for esbuild, swc, sharp etc (unless you messed with supportedArchitectures beforehand)
plus anything with a postinstall script that pulls binaries from github or s3 like playwright, puppeteer or electron will just fail without internet. and if you have any native c++ addons node-gyp will try to fetch node headers on first run, not to mention needing python, make and g++ installed. also node doesnt even ship yarn anymore so unless you committed the yarn release binary too he cant even run it
honestly stuffing zip caches into git just bloats your repo over time, for actual air-gapped envs people ship pre-built docker images, use nix or run a local verdaccio mirror instead
1
u/x0wl 1d ago edited 1d ago
I get what you're saying (and I really like the docker container idea), but the thing about yarn in particular is that it can pre-pull the native zips for different OS and CPU combinations, obviously at the cost of adding size to your repo
BTW how do you use nix for airgapped?
1
u/Zeragamba 1d ago edited 1d ago
We're using yarn in our projects as a standardized tool, and migrating off of it to pnpm hasn't been a priority. Also we have some legacy transitive dependencies that rely on node_modules and don't play nice with symlinks or hardlinks
Yarn 4+ still works great for our team
0
u/strettist 1d ago
Sheesh, why the downvotes? There are several open issues related to this as well as a community proposed solution that’s essentially been rejected. There are plenty of codebases that currently experience this as a blocker and plenty more that will once they try to make the jump.
7
u/g0liadkin 1d ago
Because it's not a typescript issue per se
3
u/strettist 1d ago
It’s kind of more complicated than it being just a Yarn problem though. The community has been trying to work with TS maintainers to find a solution for a long time, but there’s essentially been no real effort from the TS maintainer end to help find a path forward. It’s been a TS problem in that so far they’ve been inhospitable to any solution from the community.
3
2
u/epukinsk 1d ago
Keep fighting the good fight! Yarn is great and it’s totally reasonable to want TypeScript to work with it.
109
u/Dested 1d ago •
My agent is going to love this