I have a bunch of JS file that I would like to convert to TS files without having to add any typing or introducing a lot of changes.
I know I can use // @ts-ignore on the lines that I want the compiler to ignore, but is there a way to ignore the entire file?
I still would like to output a JS file, but as is, with all the errors ignores.
It's easy. Don't rename the file to .ts (until you want to deal with the errors), and use the following configuration
{
"compilerOptions": {
"allowJs": true,
"checkJs": false,
"rootDir": "src",
"outDir": "dist"
}
}
TypeScript will transpile your JavaScript files along with your TypeScript files and provide as much intellisense as possible.
I've answered a similar question in greater detail here: https://stackoverflow.com/a/49640454/1915893
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