These tricks will make ts-node faster.
It is often better to typecheck as part of your tests or linting. You can use
tsc --noEmit to do this. In these cases, ts-node can skip typechecking making it much faster.
To skip typechecking in ts-node, do one of the following:
- Enable swc
- This is by far the fastest option
transpileOnlyto skip typechecking without swc
If you absolutely must use ts-node for typechecking:
- Avoid dynamic
require()which may trigger repeated typechecking; prefer
- Try with and without
--files; one may be faster depending on your project
tsc --showConfig; make sure all executed files are included
- Set a
typesarray to avoid loading unnecessary