'How to use ts-node regardless of errors?

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 ;)



Solution 1:[1]

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.

Solution 2:[2]

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.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2