tsconfig extends with bare path ".." works when it should not
#51,782 opened on 2022幎12æ6æ¥
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
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.