-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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 template variable ${configDir} (name to be determined) for file path substitution #57485
Comments
Options that should check for
Options that are of type string or object but should not check
|
Thank you, @sheetalkamat, you are amazing! |
@sheetalkamat Awesome job, thanks! π looking forward to having this released in a TypeScript version for my shared tsconfigs π Is it planned that this will be released in TypeScript 5.5? I didn't see it in the Iteration Plan: |
@sheetalkamat thank you! This has been a feature I've wanted to see for some time now. Great to finally have it! |
Looks like will be a part of TS 5.5 (or at least is in the 5.5 Beta announcement): |
Nice, I've just tried this out yesterday and it works like a charm. Only issue I had was that somehow Intellisense in VS Code still showed me an error in the editor which wasn't actually a build error, like it doesn't understand the // base.json
{
// ...
"include": ["some-file.d.ts", "${configDir}/src"]
} // some/path/tsconfig.json
{
"extends": "../../base.json"
} βοΈ this gave me the error so i tried moving the include into the composite project's // some/path/tsconfig.json
{
"extends": "../../base.json",
"include": ["../../some-file.d.ts", "src"]
} but then I tried using // some/path/tsconfig.json
{
"extends": "../../base.json",
"include": ["${configDir}/../../some-file.d.ts", "src"]
} As I already said, it's only an error shown in the IDE (I did switch the workspace to use the project's typescript instead of the built-in one), running Maybe I'll just have to wait for VS Code to update the built-in TypeScript version once 5.5 is officially published (: |
You can go to a ts file then on the bottom right you can see a typescript button. If you press it you can select vs code ts version and set it to the projects version. If you downloaded the 5.5.0-beta from npm vs code could be set to use that type. |
maybe you overlooked this? Edit: anyway you're right. Even though I had done this before via command palette which created {
"typescript.tsdk": "node_modules/typescript/lib"
} in the project's |
This feature should be documented somewhere outside of https://www.typescriptlang.org/docs/handbook/release-notes/typescript-5-5.html#the-configdir-template-variable-for-configuration-files |
π Search Terms
"extends", "compilerOptions", "paths", "outdir", "include", "exclude", "typeRoots", "tsconfig", "ability to make tsconfig paths relative to final config"
β Viability Checklist
β 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:
π Motivating Example
A way to specify root config that can specify
include
and/oroutDir
and not needing to write than in each project.Issues: #29172, #30163, #37227, #45050, #51213
π» Use Cases
The text was updated successfully, but these errors were encountered: