_From @tommedema on August 27, 2018 3:12_
Steps to Reproduce:
git clone [email protected]:tommedema/serverless-mono-example.git
cd serverless-mono-example && yarn install && code .
random
, it is not picked up by intellisense in typescript packages that reference to it in the same workspace (e.g. sls-random
); you'd have to compile firstfor example, change fetchRandomNumber
in random
to return a Promise<string>
, and sls-random
still expects a Promise<number>
Note that sls-random
is connected with random
through Typescript 3 references:
{
"extends": "../../tsconfig.settings.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": "src"
},
"references": [
{ "path": "../random" }
]
}
And therefore intellisense should pickup the referenced typings dynamically.
Does this issue occur when all extensions are disabled?: Yes
_Copied from original issue: Microsoft/vscode#57242_
From the TypeScript Handbook: https://www.typescriptlang.org/docs/handbook/project-references.html
Because dependent projects make use of .d.ts files that are built from their dependencies, you’ll either have to check in certain build outputs or build a project after cloning it before you can navigate the project in an editor without seeing spurious errors. We’re working on a behind-the-scenes .d.ts generation process that should be able to mitigate this, but for now we recommend informing developers that they should build after cloning.
I have a similar problem. Is this a duplicate or is my example different? https://github.com/donaldpipowitch/typescript-refactoring-references
Getting the same issue, have to compile a project for its type intellisense in other projects to update when changes are made.
It's a big problem for a repo I'm working on that has 19 different package references. When running the tsc watch, it can take over 15 sec for a typing to update.
Running into the same issue in our mono-repo.
This is labeled as VS Code Tracked
, but the linked bug in their repo is closed. @mjbvz, is this something that needs to be fixed in Typescript or VS Code?
Correct me if I’m wrong, but since vscode relys on TSServer for providing information for intellesence, and the new References feature uses the output .d.ts for each project for typing; the TSServer would have to have a way to bypass the .d.ts files and directly go to the source to determine typings. I would think that this is a TS issue and not only VSCode.
Anything I can do to help this get fixed?
@mjbvz Any updates? Or a pointer to progress on the _behind-the-scenes .d.ts generation process_ @ajafff? Thanks.
I would like to bump this issue. We are running into this problem in our monorepo and it's making development more difficult in particular for newcomers.
I have a sample project that uses project reference. You need to set properly baseUrl to the top level output and this should enable type checks to work
https://github.com/wmira/react-ts-starter/tree/master/project-reference
I have a sample project that uses project reference. You need to set properly baseUrl to the top level output and this should enable type checks to work
https://github.com/wmira/react-ts-starter/tree/master/project-reference
@wmira That's the current workaround, at least what my team uses. Ideally vscode would understand types as you change them without the watch running or having to run tsc build (which I believe is the issue outlined by mjvbz).
@wmira I'm confused about your setup. Why are these properties directories that do not exist? Also, this still means that you have to compile the typscript to get references to work. As I understand the issue, this is the main problem, not that references do not work at all.
its going to get created when you compile..from the top level. baseUrl is
used by ts to resolved relative paths. E.g. do a tsc --build from the
project-reference project
On Wed, May 1, 2019, 4:32 PM Dominik Moritz notifications@github.com
wrote:
@wmira https://github.com/wmira I'm confused about your setup. Why are these
properties
https://github.com/wmira/react-ts-starter/blob/2ca6ed40242b2cf08e183f5966611d22c2138ebf/project-reference/core/tsconfig.json#L4
directories that do not exist? Also, this still means that you have to
compile the typscript to get references to work. As I understand the issue,
this is the main problem, not that references do not work at all.—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
https://github.com/Microsoft/TypeScript/issues/26913#issuecomment-488235055,
or mute the thread
https://github.com/notifications/unsubscribe-auth/AADSMEHWTI2536XYEZVRABLPTFISLANCNFSM4FTNWJZA
.
I see. But I still have to compile (and re-compile) to get working jump-to-reference in VSCode across project boundaries. Unfortunately, that's a huge UX problem.
@wmira i just gave your sample a try. However, if you delete import { greet } from 'module1/util'
in App.tsx, you'll notice that vscode can't figure out to auto import greet, back into the file.
It seems that once you include that line, that vscode can find all the symbols within module1/util fine, but before that it can't pick it up. Likewise, if you add a new file, say module/util2
and export a function hello(), vscode won't be able to find that until you've referenced it in at least one file.
Is that something that you were able to overcome with a workaround?
Just poking to ask if there is any progress on this. 🤓
I see it’s labeled as Awaiting More Feedback
and I’m wondering what kind of feedback would help here? 🤔
I definitely think this fix is high priority. I my case (yarn workspaces with nohoist and typescript modules) I haven't been able to find a good workaround.
The initial issue is fixed by #32028.
I'm not quite sure what the proposed fix actually is. Ended up using pnpm
as package manger and its workspaces which helps resolve this issue pretty easily as it symlinks referenced projects to the importing application's node_modules folder.
Most helpful comment
I would like to bump this issue. We are running into this problem in our monorepo and it's making development more difficult in particular for newcomers.