Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a option of type inheritance from extended tsconfig #57616

Closed
6 tasks done
Demianeen opened this issue Mar 2, 2024 · 1 comment
Closed
6 tasks done

Add a option of type inheritance from extended tsconfig #57616

Demianeen opened this issue Mar 2, 2024 · 1 comment

Comments

@Demianeen
Copy link

Demianeen commented Mar 2, 2024

πŸ” Search Terms

  • tsconfig inheritance
  • tsconfig paths merge
  • tsconfig extend paths
  • TypeScript configuration extension
  • TypeScript path resolution

βœ… Viability Checklist

⭐ Suggestion

Introduce a mergePaths option for tsconfig.json that would be false by default allows for the merging of paths from the extended tsconfigs files and the current configuration.

πŸ“ƒ Motivating Example

In a monorepo setup, there's often a base tsconfig (e.g., tsconfig.base.json) at the root, containing global paths that are accessible to all packages (package public API). However, individual packages may also require their own, package-specific absolute paths for various reasons, such as linting or to simplify imports.

Currently, when a package's tsconfig.json extends the root tsconfig, any paths defined in the package's tsconfig overwrite those from the base. This behavior requires developers to replicate the base paths in every package's tsconfig, leading to maintenance overhead and potential for inconsistency.

πŸ’» Use Cases

  1. What do you want to use this for?
  • Monorepo Management: In a monorepo setup, managing shared and package-specific paths efficiently without duplication.
  • Simplified Configuration: Reducing configuration overhead and potential for errors by not having to duplicate shared paths across multiple tsconfig.json files.
  • Enhanced Developer Experience: Streamlining the development process within monorepos by ensuring smooth path resolution across packages.
  1. What shortcomings exist with current approaches?
  • Duplication of path configurations across multiple tsconfig.json files.
  • Increased maintenance overhead and potential for inconsistency.
  • The current need to manually merge paths in each package's tsconfig.json, which is error-prone and cumbersome.
  1. What workarounds are you using in the meantime?

There are currently few workarounds that I know:

  • manually duplicating shared paths in every package's tsconfig.json, adjusting as necessary to avoid conflicts
  • utilizing scripts to dynamically generate tsconfig.json files with merged paths, which adds complexity
  • just adding the path to the monorepo root tsconfig (not really workaround)
@MartinJohns
Copy link
Contributor

Duplicate of #57486.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants