Ludwik Ludwik - 1 year ago 71
TypeScript Question

Typescript: How to compile only the files in a folder

The typescript docs state that in

we can control input files either with
where we list all files, or with
. I have all my source files in a
directory and only want to compile all files that are there (to a bifferent directory,
). I could
all other files and directories, but I might miss something. I don't want to manually add every file to

How can I specify to typescript that it should compile only the typescript files it finds in the
directory, and nothing else?

Answer Source

According to the TypeScript documentation, the only way to do this within tsconfig.json is either to:

  1. Exhaustively list the files you do want to compile under files; or
  2. Exhaustively list the files and directories you don't want to compile under exclude.

It does mention that files referenced by included files will also be compiled, so it's possible that 1. wouldn't have to list everything individually, but I haven't tried that myself.