microsoft / microsoft/TypeScript
tsconfig.json extends field node-style resolution broken
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Bug Report
The docs say (emphasis mine):
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.
This worked up until recently but is currently broken. I can't pin down a specific version where it stopped working as I guess the code that loads the config may be from a dependency of typescript that is shared across different versions.
We've got a module that contains org-wide tsconfig that we want our projects to extend - they could be regular modules, monorepo packages, etc.
Those projects can and do get pulled in as github urls (or https://gitpkg.now.sh/ urls for monorepo packages) for other modules as dependencies during PRs. Those projects are typically written in js but generate types from jsdoc comments using the npm prepare script for the current module to use, which now fails as it can't resolve the extends path.
You can't always predict which node_modules folder will contain the relevant dependency, so doing Node.js style resolution (e.g. stepping up through directories) is essential for our use-case.
🔎 Search Terms
- tsconfig extending npm package
- tsconfig extend node_modules
- tsconfig node_modules
- tsconfig extend resolve
🕗 Version & Regression Information
Not sure, it was working before Christmas, now it does not.
🙁 Actual behavior
Typescript does not resolve the extends path using Node.js style resolution.
🙂 Expected behavior
Typescript should resolve the extends path using Node.js style resolution.
References:
https://github.com/microsoft/TypeScript/issues/18865
https://github.com/microsoft/TypeScript/issues/30701
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing TypeScript's tsconfig.json extends resolution and review the linked issues 18865 and 30701 alongside the extends documentation. Done means configuration paths resolve with Node.js-style lookup, including dependencies in nested node_modules directories, and the reported prepare-script scenario works again.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- node.js, typescript
- Domain
- build-system, compilers
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100