LearningTypeScript / site

Companion website for the Learning TypeScript book.
https://learningtypescript.com
MIT License
48 stars 12 forks source link

Article: why excluded files still get included #83

Open JoshuaKGoldberg opened 2 years ago

JoshuaKGoldberg commented 2 years ago

https://www.typescriptlang.org/tsconfig#exclude

Specifies an array of filenames or patterns that should be skipped when resolving include.

Important: exclude only changes which files are included as a result of the include setting. A file specified by exclude can still become part of your codebase due to an import statement in your code, a types inclusion, a /// <reference directive, or being specified in the files list.

It is not a mechanism that prevents a file from being included in the codebase - it simply changes what the include setting finds.

This gets asked a lot. I should write an article that mentions what's happening and workarounds.

https://discord.com/channels/508357248330760243/942074070860705852/1008777933957120000