TypeScript compiler is not following tsconfig spec

If Compile on Changes is selected in settings and I specify a pattern to exclude in my tsconfig it is still compiling those files to .js.

I found this previous post: https://intellij-support.jetbrains.com/hc/en-us/community/posts/360000432259-Setting-up-a-typescript-compile-scope-to-exclude-tests-folder-from-being-compiled-doesn-t-work- which is absolutely not how it's supposed to work. 

Per https://www.typescriptlang.org/docs/handbook/tsconfig-json.html it should be excluding those files that match the pattern from being compiled. Please reference their example tsconfig.

If I set "compileOnSave" in tsconfig to false, and exclude files, the excluded files get compiled. Why is this not working the other way around?

Additionally, if I compile through by specifying the tsconfig.json file, it compiles correctly. 

 

1 comment
Comment actions Permalink

Excluding files from all tsconfig.json files don't prevent them from being processed by Typescript language service/compiling on Save: the files not included anywhere are still processed using the default compiler settings. Please follow https://youtrack.jetbrains.com/issue/WEB-43179 for updates

If you like certain files to be excluded from being compiled, either create a separate tsconfig.json for them, with

"compileOnSave": false

 

or disable Recompile on Save in Settings | Languages & Frameworks | TypeScript and use the Compile action in Typescript tool window, choosing your tsconfig.json there

0

Please sign in to leave a comment.