I've got some trouble with ts-node when I develop.
I want to test something, so as you know, comment is my best friend. But with ts-node I've got this error :
'foo' is declared but its value is never read
But I don't want to comment all my unused variables because theses variables are in fact useful for the code after testing.
So, is there a solution like ts-node --please-let-me-work
to ignore these error ?
Thanks ;)
No you shouldn't use it in production, even though it will cache the compiled files it'll be slower to start and consume more memory because it keeps around an instance of the compiler and files in memory.
Default config If no tsconfig. json is loaded from disk, ts-node will use the newest recommended defaults from @tsconfig/bases compatible with your node and typescript versions. With the latest node and typescript , this is @tsconfig/node16 . Older versions of typescript are incompatible with @tsconfig/node16 .
ts-node is an npm package which allows the user to run typescript files directly, without the need for precompilation using tsc . It also provides REPL. ts-node does not bundle typescript compiler, so you might need to install it.
ts-node
has a --transpile-only
(or -T
) argument. It will ignore all type errors and just build your project.
My 2022 suggestion for this to set up esbuild
instead. Not a plug and play experience, but extremely fast. We use esbuild
for (constant) building during development, and rely on other tools to report type errors.
If you use ts-node
, you can use this alternative :
$ ts-node-transpile-only filename.ts
It will run the typescript file without checking errors.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With