microsoft / microsoft/TypeScript

Ability to extend compilerOptions's paths config

Open
#44,589 18 comments 137 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.4k
Avg merge
1d 19h
Merged PRs (30d)
117

Description

Suggestion

I have a tsconfig.base.json file for the monorepo, it defined paths that all project can use

{
  "compileOnSave": false,
  "compilerOptions": {
    ```
    "paths": {
      "@aegis/ui": ["libs/ui/src/index.ts"],
      "@aegis/ui/*": ["libs/ui/src/*"],
      "@aegis/shared": ["libs/shared/src/index.ts"],
      "@aegis/shared/*": ["libs/shared/src/*"]
    }
  },
  "exclude": ["node_modules", "tmp"]
}

Each project has own tsconfig.json, also defined paths that only for itself

{
  "extends": "../../tsconfig.base.json",
  "compilerOptions": {
    "paths": {
      "@environment": ["src/environments/environment.ts"]
    }
  },
  "files": [],
  "include": [],
  "references": [
    {
      "path": "./tsconfig.app.json"
    },
    {
      "path": "./tsconfig.spec.json"
    },
    {
      "path": "./tsconfig.editor.json"
    }
  ]
}

Unfortunately, the paths would be overwritten.

I have to add tsconfig.base.json paths item to each project.

So, it's necessary to provide a solution for this case.

🔍 Search Terms

  • compilerOptions paths extends label:Suggestion

List of keywords you searched for before creating this issue. Write them down here so that others can find this suggestion more easily and help provide feedback.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start by tracing how compilerOptions.paths is inherited from tsconfig.base.json into a project's tsconfig.json and review the issue discussion for expected merge semantics. Done means inherited path mappings remain available while project-specific mappings can be added without repeating the base configuration.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.