I have a problem in a big project that uses typesafe-actions. tsc in watch mode starts many times slower than a standalone check.
After some googling and debugging I think I found the root cause of the slow down.
Looks like tsc in watch mode generates temporary declaration (d.ts) files for incremental checks. And it turned out that generated typings for reducers are really big so that tsc spends a lot of time producing these temp files when starting.
The declaration files are big because of the recursive types that typescript doesn't handle well. For instance, this is what tsc produces for benchmarks/10-actions.ts from this repo - https://gist.github.com/11bit/ae4a19748c0ffaec44db4f2890e030d8. Looks like typescript tries to unfold them or something.
The workaround to optimize it is to expose these internal recursive types HandleActionChainApi and HandleTypeChainApi, so that tsc will be able to use them as is.
Description
Hi!
I have a problem in a big project that uses typesafe-actions.
tsc
in watch mode starts many times slower than a standalone check.After some googling and debugging I think I found the root cause of the slow down. Looks like tsc in watch mode generates temporary declaration (d.ts) files for incremental checks. And it turned out that generated typings for reducers are really big so that tsc spends a lot of time producing these temp files when starting.
The declaration files are big because of the recursive types that typescript doesn't handle well. For instance, this is what tsc produces for
benchmarks/10-actions.ts
from this repo - https://gist.github.com/11bit/ae4a19748c0ffaec44db4f2890e030d8. Looks like typescript tries to unfold them or something.The workaround to optimize it is to expose these internal recursive types HandleActionChainApi and HandleTypeChainApi, so that tsc will be able to use them as is.
There is a discussion about a similar issue in typescript repo https://github.com/microsoft/TypeScript/issues/34119
Related issues:
Checklist
For bugfixes:
For new features:
dts-jest
dts-jest