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

Clarity about the what path references are relative to #50529

Open
kwasimensah opened this issue Aug 29, 2022 · 3 comments
Open

Clarity about the what path references are relative to #50529

kwasimensah opened this issue Aug 29, 2022 · 3 comments
Labels
Docs The issue relates to how you learn TypeScript Help Wanted You can do this
Milestone

Comments

@kwasimensah
Copy link

Suggestion

πŸ” Search Terms

references path relative

βœ… Viability Checklist

My suggestion meets these guidelines:

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

⭐ Suggestion

Both https://www.typescriptlang.org/tsconfig#references and https://www.typescriptlang.org/docs/handbook/project-references.html aren't specific about what the string in path is relative to (the current tsconfig, the current working directory, rootDir, etc)

πŸ’» Use Cases

I'm writing some build scripts around invocations of tsc with a lot of linking, aliasing, etc and I don't want to put absolute paths in the generated tsconfig files

@fatcerberus
Copy link

IIRC all paths in a tsconfig are relative to the tsconfig.

@kwasimensah
Copy link
Author

I figured as much. But given:

https://www.typescriptlang.org/tsconfig#baseUrl and https://www.typescriptlang.org/tsconfig#paths
https://www.typescriptlang.org/tsconfig#rootDirs
https://www.typescriptlang.org/tsconfig#preserveSymlinks

I've run into issues before where those complicated the paths used in look up by tsc

But I also see https://www.typescriptlang.org/tsconfig#files which I guess I took for granted my assumption that it's always relative to the tsconfig.json

@kwasimensah
Copy link
Author

So I realized, the feature request hiding in this question is if there could be a way to have a fixed root for tsconfig.json resolution.

Given root with:
a/tsconfig.json
b/tsconfig.json
c/tsconfig.json

if there was way to have the references be their root relative paths instead of having to calculate paths relative to each other

@RyanCavanaugh RyanCavanaugh added Help Wanted You can do this Docs The issue relates to how you learn TypeScript labels Aug 30, 2022
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs The issue relates to how you learn TypeScript Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

3 participants