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 {root} helper for tsconfig.json (for avoiding multiple ../../) #37227

Closed
2 of 5 tasks
Yegorich555 opened this issue Mar 5, 2020 · 4 comments
Closed
2 of 5 tasks
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript

Comments

@Yegorich555
Copy link

Search Terms

helper {root} {workspace} in tsconfig.json

Suggestion

I have the following project structure

tsconfig.json
>folder
   >folder
     >folder
       tsconfig.json => 
         {
             "extends": "../../../tsconfig.json"
              ... 
         }

I didn't find any path-helper that can replace "../../../" to {root} where the root is the current workspace folder

Use Cases

Avoiding using "../../../" because of this is a headache for refactoring

Examples

// folder/folder/folder/tsconfig.json
{
  "extends": "{rootOrWorkspaceFolder}/tsconfig.json"
   "paths": {
      "root/*": ["{rootOrWorkspaceFolder}/*"]
    }
}

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 expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.
@MartinJohns
Copy link
Contributor

What is the "current workspace folder"? How is that determined?

@Yegorich555
Copy link
Author

  • process.cwd() in NodeJs...
  • package.json can point on the workspace folder. It always in the root

A lot of packages use similar logic for defining {root} (jest for example)

@RyanCavanaugh RyanCavanaugh added Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript labels Mar 9, 2020
@karlhorky
Copy link
Contributor

karlhorky commented Oct 18, 2022

I guess this is pretty similar to my new issue #51213, wonder if I should close 51213 in favor of this... (or the other way around)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Awaiting More Feedback This means we'd like to hear from more people who would be helped by this feature Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

5 participants