I'm working with the TypeScript compiler API. When initializing a program, I'm asked to supply a CompilerOptions
object. I want to use the CompilerOptions
for a given tsconfig.json
file, but I can't seem to figure out what the right way is to get this.
I think I'm supposed to use parseJsonConfigFileContent
but that also needs a ParseConfigHost
. They say that it's easy to implement yourself, but particularly the method readDirectory
seems rather complicated to implement yourself. As far as I can see, you need to return all TypeScript files in a certain directory, accounting for a excludes
and includes
.
Surely, TypeScript does this internally somewhere already. How can I use the default readDirectory
or ParseConfigHost
?
Phrased in another way: what's the simplest way to get the CompilerOptions
for a given TypeScript project?
findConfigFile
takes care of that and you can always pass"./"
there. – Burgoyne