Add template variable ${configDir} (name to be determined) for file path substitution ยท Issue #57485 ยท microsoft/TypeScript (original) (raw)
๐ Search Terms
"extends", "compilerOptions", "paths", "outdir", "include", "exclude", "typeRoots", "tsconfig", "ability to make tsconfig paths relative to final config"
โ Viability Checklist
- 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 isn't a request to add a new utility type: https://github.com/microsoft/TypeScript/wiki/No-New-Utility-Types
- This feature would agree with the rest of our Design Goals: https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals
โญ Suggestion
Subset of #56436
Today when all the options that are file paths, are always relative to config they are specified in. But that also means that if you are extending tsconfig and you want eg say outDir
to be same name but relative to your config, you have to re-specify it in the config. The proposal is to use template variable in base config which would mean that the resulting file paths are relative to final config directory. Name is to be determined.
Consider:
Today the resulting config of project1 is:
Proposal is to write base.tsconfig.json
as:
and this should result in computed tsconfig.json
as:
Names that came up in design meeting:
- configLocation
- configFolder
- configDirectory
- projectLocation
- projectFolder
- projectDirectory
๐ Motivating Example
A way to specify root config that can specify include
and/or outDir
and not needing to write than in each project.
Issues: #29172, #30163, #37227, #45050, #51213
๐ป Use Cases
- What do you want to use this for?
- What shortcomings exist with current approaches?
- What workarounds are you using in the meantime?