Dominik πŸ‡ΊπŸ‡¦ Profile picture
Oct 18 β€’ 10 tweets β€’ 3 min read
The #TypeScript compiler might not be the fastest - but why is that such a big problem?
"We have a large project" - I get that, but there are other things you can do that will impact development speed and DX:
1) decouple type checking from development

Coupling your dev server start & reload with type-checking is not only slow and mostly unnecessary, it's also hindering. Comment out one line of code, see an error in the browser because of unnecessary import... why?
TS6133: 'IconArrowRight' is declared but its value is never read.

I know, I'll fix it later. Who cares? TypeScript is perfectly capable of emitting JS even though you have type errors. Use that!
I mostly rely on red squiggles I'm seeing in my editor, and then the CI pipeline for usages that I've missed. It's good enough. I rarely run the "type-check" command for the whole repo locally.
2) Chunk your "large project"

If your repo is big and everything needs to be type-checked all the time, you'll have other problems as well:
- everyone can import from anywhere, leading to a big mess that's hard to untangle
- you'll also test and lint everything all the time
The solution: A monorepo with dedicated packages for features. This not only defines clear boundaries and dependencies, it also means you can add a task runner like @NxDevTools or @turborepo to speed things up.
A change in featureA should never need to trigger type checking / linting / testing of featureB, unless B depends on A.
This is probably the biggest speed gain for CI and locally you can get.
Our monorepo has 24 packages and it's growing. A change in our design-system is kinda expensive because it is used in almost all packages. We're talking about 30 seconds to type-check everything here. Not great not terrible.
For most teams, type-checking takes less than 5 seconds, and our CI pipeline got a lot faster since we switched to @NxDevTools and parallel execution.
The @typescript compiler is a very complex tool that is hard to replace. I don't think it will happen unless the TS core team decides to do it themselves. I fully agree with this:

β€’ β€’ β€’

Missing some Tweet in this thread? You can try to force a refresh
γ€€

Keep Current with Dominik πŸ‡ΊπŸ‡¦

Dominik πŸ‡ΊπŸ‡¦ Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @TkDodo

Oct 16
So the `use` proposal is quite interesting, there's some chatter already about it being an out-of-the-box react-query together with the yet unknown cache api.

Let me elaborate why I do not think that's the case. The reports of react-query's death are greatly exaggerated:
The obvious one is: react-query does so much more. It tries to keep your application in-sync with your server state.

Smart refetches; interval refetching; retries; infinite queries; offline support; lagged data; persisters; prefetching; hydration for SSR;
It will also _never_ throw away stale data; Once you have `data` fetched, you can choose to display it. It's unclear to me how the react cache api will handle this, but my guess is: Once the cache is invalidated, a component trying to read it will suspend again - so full spinner.
Read 9 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(