Replies: 5 comments 1 reply
-
Hi @connorjs, wondering what you ended up doing with this |
Beta Was this translation helpful? Give feedback.
-
Shouldn't it after it has run for the package itself get a cache hit in each of the apps that list the typescript package as a dependency? |
Beta Was this translation helpful? Give feedback.
-
My reading of the guide and the blogpost hasn't lead me to a clear understanding of the benefits of turborepo for TypeScript monorepos. As the blogpost says:
If this is true, then the entire monorepo must be transpiled in a single pass, and there is no possibility to parallelize the task of typechecking - the TypeScript compiler must traverse the entire module graph in order to build the types necessary to check the code in the consuming application. Thus, it would appear that Turborepo doesn't really help speed up TypeScript compilation using the TypeScript package guidelines their own docs provide. Alternatively, the blogpost continues:
If my understanding is incorrect, I would love to learn otherwise! |
Beta Was this translation helpful? Give feedback.
-
Right, it is not optimal for sure. I am currently trying to set the exports type field to point to built d.ts files. Along with |
Beta Was this translation helpful? Give feedback.
-
Hey, folks, just took a look a this as I ran into it myself and verified the behavior with What I'm finding is that Just-in-Time Packages end up getting checked by their consumer. This makes sense, since the consumer is being fed raw TypeScript, so it's getting included in that program's files. Therefore, from TypeScript's perspective, those files need type checked.
If anyone here wants to check my understanding of this, please do! We can write this into the tradeoffs section of the page linked above. |
Beta Was this translation helpful? Give feedback.
-
I have followed the TypeScript guide and read the "main" TypeScript blog post by Jared. (I referenced the original one a couple years back from tsdx days.)
Now that I'm using turbo repo though, I'm uncertain how to handle
tsc
.First attempt: Use "internal" TypeScript packages and include
tsc
in each package. We wanttsc
in each package to speed up builds and turborepo handles the orchestration and caching.However, I think this results in duplicate work. If we have A depends on B, then B gets type-checked twice: Once during B's
tsc
and again during A'stsc
due to the nature of "internal" TypeScript packages. I think.Can someone confirm this? (I used--explainFiles
option oftsc
and B's contents in A's run.)Edit: I confirmed this by intentionally inserting faulty TS code and running
turbo run tsc --continue
(continue docs).Second (future) attempt: Therefore, it seems like we have two choices: (1) Only run
tsc
at the application level (which still has duplicates if packages shared across apps) or (2) go back to TypeScript project references.Should I try out project references? I have avoided them for a while given the article.
Beta Was this translation helpful? Give feedback.
All reactions