-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Type updates don't propagate in monorepo across package boundaries #30946
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
Comments
Can you share a small example project or describe your project structure in more detail |
Yea, sorry for lack of detail here. I actually wonder if this isn't something weirdly specific to me, because I imagine a lot of people would have run into it. I have a monorepo managed by yarn workspaces. All the packages share a parent tsconfig.base.json:
tsconfig.json
This is really more of a VSCode issue and I'm realizing I think I used the wrong tab to open this issue, but basically if I make a change to any package, the parents of it won't see the type update in VSCode. But if I go to |
This is a big issue for me as well. I use project references and changing code in one project does not update the types for that first project used in another project. I think this is a TS and VSCode issue so it seems okay to file it here. |
Is this a duplicate of #26913? |
Well it happens with or without references, any symlink module that updates won't get picked up until you restart the typescript server. Given we use a monorepo and have pretty well-split-up packages, I actually hit |
More information: I do have watch running inside typescript (Build > tsc: watch) from the root. It compiles everything fine, the types do change in the output directory. If I restart it picks up the changes properly. But it just doesn't look for updates until you do so. |
Related: The |
Also related: The |
I've been experiencing this as well for a couple months. Thanks to @natew for the tip on restarting TS server, I've just been restarting VSCode entirely 😂 |
Noticing this as well, you can also open the file which contain the updated types and VSC will pick them up. But that is annoying as hell as well. |
This is a pain in the butt, having this issue as well I just noticed this issue is over a year old. Can we have some TS people at least weigh in on this? @sheetalkamat @RyanCavanaugh @sandersn @mjbvz |
Unfortunately, source-level dependencies don't really work in TypeScript. It's a shame, because I'd prefer that package consumers, not package authors, decide which environments (browsers, Node.js versions, or language features) are supported. So with that in mind, you have to build your packages and point You end up with something like this in package.json: "main": "./dist/index.js",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts", |
Any update on this? Seems to still be an issue |
This is still the issue |
@steve-taylor that doesn't fix it, but strangely a few days ago for no reason at all this started working for me, I wonder if VSCode did something? |
I think this has been resolved by some changes in watch strategy. Please open a new issue with complete repro steps if you're seeing this. Thanks! |
Steps to Reproduce:
I was looking for an open issue thinking this would be obvious, but don't see one. It's a huge annoyance working in a mono-repo, it means essentially youre hitting "restart TS server" many times a day.
Apologies if this is already opened.
The text was updated successfully, but these errors were encountered: