Open IlyaSemenov opened 1 year ago
This is surely a bug:
There is special logic to treat this as a filesystem path when it starts with ../
or ./
, but not when the path is exactly ..
.
It's also odd that, if given a path-like string, the logic appends .json
but if given a module-like string, it appends /tsconfig.json
.
Bug Report
🔎 Search Terms
tsconfig extends parent
🕗 Version & Regression Information
⏯ Playground Link
Playground links with relevant code: A. https://stackblitz.com/edit/node-adwy3r B. https://stackblitz.com/edit/node-aiwgcb
💻 Code
Playground A
tsconfig.json
:foo/tsconfig.json
:Playground B
tsconfig.json
:foo/tsconfig.json
:🙁 Actual behavior
In playground A, running
tsc --showConfig
in directoryfoo
works.In playground B, running
tsc --showConfig
in project root fails:🙂 Expected behavior
Both playgrounds are kind of symmetrical. I expect either both A and B to work, or both of them to fail.
I expect the "extends" specification to be either followed: "The value of extends is a string which contains a path to another configuration file to inherit from. The path may use Node.js style resolution.", or adjusted to reflect the actual behaviour.
I expected the Typescript 3.2 changelog to be either followed: _"TypeScript 3.2 now resolves tsconfig.jsons from node_modules. When using a bare path for the extends field in tsconfig.json, TypeScript will dive into node_modules packages for us."_ or adjusted to reflect the actual behaviour.
Neither of
..
and./foo
are located insidenode_modules
. Both of them do havepackage.json
andnode_modules
. I don't see what causes the different behaviour.