-
Notifications
You must be signed in to change notification settings - Fork 12.7k
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
Cannot extend the "typeRoots" option anymore #54515
Comments
From my testing the extend behaviour does appear to function, however the relative paths are treated relative to the child tsconfig rather than relative to the tsconfig in which it was declared. This does functionally mean it must be included in all child tsconfig files though. I can't reproduce it with the setup in the issue, but if I create a tsconfig in the repo root with,
any packages that extend it that are nested in folders don't function unless I add relative typeRoots for each level of nesting,
This for example allows packages one directory deep to access types. |
hello I am having this issue, I tried importing the file with the typings inside here is my github repo |
Hey, sorry for only answering now. I'm still having the issue from time to time (not on all packages, which is why it feels "random"). I still have the same config, but on each package I have an issue with, adding the typeroots to the monorepo root submodule fixes it (even though it's already in my base config). |
Having the same issue. |
|
@sheetalkamat but in a monorepo case where we have a root |
You should be setting |
So in our case, we have a root Every package extends it (e.g. |
Are you expecting types to be present in ["node_modules/@types", "libs/typings"] relative to tsconfig.base.json? if not then yes you would need to override it. |
Yes, they are relative to the tsconfig.base.json |
This issue has been marked as "Working as Intended" and has seen no recent activity. It has been automatically closed for house-keeping purposes. |
Can we reopen it as we're still discussing it? |
@danr-za you can check why the resolution is failing by using |
@sheetalkamat thanks for pointing this out, I was finally able to resolve that. And as you mentioned in your previous comments, older version were probably always looking for types in |
@sheetalkamat to clarify, you're saying that in this setup:
Where in {
...
typeRoots: ["./types"]
...
} and in {
...
extends: "../tsconfig.json"
...
} but not specified {
...
types: [...]
...
} nor specified {
...
typeRoots: [...]
...
} you consider it to be working as intended that I get no type resolution in
If so, can you please elaborate on the intention with this design? It boggles the mind. |
Yes this is working as intended because in both tsconfigs (in parent and child) the |
@sheetalkamat again, to clarify, what happens is that |
The paths specified in config file have always been relative to file in they are defined in so in the parent/tsconfig.json the typeRoot is not We have been investigating file path inheritance as string and then computing it relative to final config but that is still under investigation and this is current design as it has been always. |
@sheetalkamat I misunderstood you earlier. The current design is logical, is how I would expect it to work. I understand now why you said it is working as intended. Thank you for takin the time to respond and clarify--I've taken the conversation well beyond the original issue. |
Bug Report
Adding a common "typeRoots" key on an extended configuration is not taking into account anymore. We discussed it a little bit on this PR: #51715
🕗 Version & Regression Information
it used to work on the v
5.0.4
but it stopped working when I migrted to5.1.3
.🙁 Actual behavior
I have a global tsconfig json file as following:
And I'm using it within my monorepo on each package as following:
However as you can see, I have to re-declare the typeRoots option which was not necessary before the library update.
🙂 Expected behavior
Being able to extend the typeRoots configuration.
Thanks!
The text was updated successfully, but these errors were encountered: