Support tsconfig inheritance
As of TS 2.1, there is now an extends field that allows configs to inherit configuration from other files. It'd be great if this library emulated that behavior (though perhaps it should be configurable)
You're welcome to submit a PR, but I'm not sure I'll be implementing it myself here. If you need this, it's probably best to parse the tsconfig.json file using TypeScript to avoid additional changes in the future.
If anyone's interested, I implemented support for extends in the grunt-ts tsconfig feature. The code to do so was fairly minimal, though I do have a dependency on underscore.
https://github.com/TypeStrong/grunt-ts/pull/398
I've made a PR #27 which handles "extends" (multiple too).
@blakeembrey at the moment i "just" wrote a little merge function for this behavior cause if we use the typescript api we could rewrite a bit more than i did.
it's probably best to parse the tsconfig.json file using TypeScript to avoid additional changes in the future
I would be grateful to you if you can provide some docs, because I can't find it and ts codebase is too huge and difficult to search into.
And one more question
it's probably best ... using TypeScript to avoid additional changes in the future
So what is this library for? (no irony or gibe). In my opinion any manipulations with tsconfig.json should be done using TS to avoid additional changes in the future
@rifler Legacy. It used to be required because TypeScript didn't expose the features needed. It could still be used by people that want to load tsconfig.json files but don't want to include the entire TypeScript compiler. You can reference https://github.com/TypeStrong/ts-node if you'd like, it parses the file (there's a few different methods for slightly varying things, I had to read through the TypeScript codebase myself).
Awesome, thank you so much, you save me a lot of time.
@blakeembrey so how does one use the typescript package to load the config in a way that supports inheritance?
@ntucker You're best diving into the TypeScript package and taking a look. I left a link above to a package I maintain that can help you figure it out (it's not the best way due to legacy APIs in TypeScript).
@ntucker Try something like https://github.com/TypeStrong/ts-node/blob/4dbc15dc20da90c0496d117481a7467b6d637cb8/src/index.ts#L631 (not 100% sure from memory if that one method support inheritance, you might need to combine with parseJsonConfigFileContent). I believe there's a short-hand you can use exported by TypeScript that does both in a single function.
https://stackoverflow.com/a/53898219/1046439 had the solution. Thanks for pointing me in the right direction @blakeembrey !