The compilerOptions.outDir
config is incorrectly resolved when in a shareable config · Issue #29172 · microsoft/TypeScript (original) (raw)
TypeScript Version: 3.3.0-dev.20181222
Search Terms: outDir
, output directory
, outDir extends
Expected behavior:
TypeScript 3.2 got support for configuration inheritance via node_modules packages. I have created a package with a shareable config. In this shareable config, I have defined the outDir
option: https://github.com/sindresorhus/tsconfig/blob/50b0ba611480ed45b97a59b910f5bb5e8cbc25ef/tsconfig.json#L2-L3 as I always use the same outDir
and don't want to have to specify it in each project.
I expected the outDir
path to be resolved against the project root, even when it's defined in an extended config.
Actual behavior:
It turns out the outDir
relative path is actually resolved against the shareable config path instead of the project's root (tsconfig.json
) path. So when I have a project foo
, and compile TypeScript, the output ends up in foo/@sindresorhus/tsconfig/dist
instead of foo/dist
.
You can reproduce it by cloning https://github.com/sindresorhus/ow/tree/8ae048c4931dfd51b496cefb40b24c78d3722be6, then removing this line https://github.com/sindresorhus/ow/blob/8ae048c4931dfd51b496cefb40b24c78d3722be6/tsconfig.json#L4 (which is a workaround to the problem), and then run $ npm test
. The compiled TS code will end up in node_modules/@sindresorhus/tsconfig/dist
instead of dist
.