tsconfig extends with bare path ".." works when it should not
#51,782 opened on Dec 6, 2022
Description
Bug Report
🔎 Search Terms
tsconfig extends parent
🕗 Version & Regression Information
- This changed between versions 3.1.8 and 3.2.1
⏯ 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:
{"extends": ".."}
Playground B
tsconfig.json:
{"extends": "./foo"}
foo/tsconfig.json:
{}
🙁 Actual behavior
In playground A, running tsc --showConfig in directory foo works.
In playground B, running tsc --showConfig in project root fails:
tsconfig.json:2:14 - error TS6053: File './foo' not found.
2 "extends": "./foo"
~~~~~~~
🙂 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 inside node_modules. Both of them do have package.json and node_modules. I don't see what causes the different behaviour.