Skip to content

tsconfig.json - extends property should handle more than one config paths #42386

@RamoFX

Description

@RamoFX

Suggestion - tsconfig.json - extends more than one configs

🔍 Search Terms

  • tsconfig multiple extends config
  • TS5024: Compiler option 'extends' requires a value of type string
  • tsconfig extends
  • tsconfig extends multiple
  • tsconfig extends string array

✅ Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of [TypeScript's Design Goals]

⭐ Suggestion

A tsconfig.json have compilerOptions, include, files and extends, I'll be describing the extends feature suggestion.

It only takes a string type which is a path to the tsconfig.json, but it would be useful to take more paths.

So extends property should be able to process one or more paths.

📃 Motivating Example

Below I attached an example code image of what this can be helpful for. The image shown tree of 7 config parts in the left side and the code example on the right of extends them together.

image

💻 Use Cases

What do you want to use this for?

It will give a lot of possibilities.
For example, you will be able to make one configs directory and mixing them via extends for best config and fast project configuration.

What shortcomings exist with current approaches?

Inconvenience: you need to chain them one by one, which is of course not the best practice. If you will add another one and next ot it will be another 10 files then it takes some time to make it works again.

What workarounds are you using in the meantime?

Chaining them (b extends a, c extends b, etc.).
Or you can even make some script that generates certain config from other parts.
Or maybe some package that includes all files into one.

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions