Closed DaniGuardiola closed 10 months ago
Try tshy --watch
Not going to support other transpilers. They're mostly faster because they don't type check, and type checking is something I want in my build.
Ah, didn't know the watch option was already there, that's nice!
Re: other transpilers, just to clarify, I don't mean as a complete replacement to tsc - you would still need that to generate declaration files. I was thinking more in terms of building the actual code.
tsup for example builds the code with esbuild and then generates declaration files with tsc. This means you still get type checking, but compilation of the actual code is way faster (which is quite useful in a --watch situation and in large projects).
Hopefully that clarifies where I'm coming from?
tsup for example builds the code with esbuild and then generates declaration files with tsc. This means you still get type checking, but compilation of the actual code is way faster (which is quite useful in a --watch situation and in large projects).
Have you quantified this "way faster" claim?
Esbuild is significantly faster than many other bundlers, but the slow part of a TSC build is always the type checking. If you run TSC without type checking, it's almost as fast as tsup or tsx. And you're suggesting taking that hit of doing the type check noEmit compilation anyway, so... why? Isn't that always going to be just as slow? Writing files from Rust or Go isn't magically faster than writing files from JS, that's limited by fs performance; it's the computational work of typechecking that makes it slow.
That's a very fair point 👍
I guess the situation would change if/when something like https://github.com/dudykr/stc gets good enough, but until then I'm fully convinced that this is the right call.
Yeah, I'm eager to see what that comes to.
I suspect tshy will always be tsc-first as the "official", but it could add a buildCommand
config or something, that just defaults to tsc -p {CONFIG}
, where the {CONFIG}
(or some other token) is filled in with the path to a tsconfig file to use for the build dialect in question.
Would love to have a
--watch
option of some sort to automatically recompile. Maybe it can use tsc's native--watch
option.Tangentially, I also wonder if it'd be possible to use a faster transpiler/bundler (than
tsc
) to build the javascript part of packages, liketsup
does, using something likeesbuild
,swc
orbun
. But I haven't read 100% of the README so maybe there's a good reason not to do this that I'm missing, not filing an issue just in case :P