Skip to content

VSCode unable to retrieve typing information with composite and emitDeclarationOnly #43909

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

Closed
JasonGore opened this issue Apr 30, 2021 · 3 comments · Fixed by #43914 or GulajavaMinistudio/TypeScript#483
Assignees
Labels
Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status.

Comments

@JasonGore
Copy link
Member

JasonGore commented Apr 30, 2021

Bug Report

🔎 Search Terms

composite project references emit declaration emitdeclarationonly vscode

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about: declarationEmitOnly and composite/project references

I've tried:

  • 4.2.4
  • 4.3.0-beta
  • 4.3.0-dev.20210430
  • VSCode: 1.55.2

⏯ Playground Link

I don't think it's possible to set up multiple projects using project references in Playground. If I'm mistaken, please let me know. For now I've created the smallest repro I can below.

💻 Code

As this uses project references I set up a basic monorepo with no external deps other than typescript.

To repro (also in README.md):

  1. clone https://github.com/JasonGore/ts-composite-declaration.git
  2. run yarn
  3. cd packages/emit-standard
  4. yarn tsc
  5. cd ../packages/emit-composite
  6. yarn tsc (although I don't think this should technically be needed for projrefs)

Open VSCode from repo root and open packages/consumer/src/index.ts and note comments.

🙁 Actual behavior

This is an emitDeclarationOnly example emitting type information for packages that have .js files. The only difference between emit-standard and emit-composite is that one has composite set to true and is a reference of consumer package.

In VSCode, emit-composite seems unable to retrieve typing information, whether or not emit-composite/lib output exists:

image

However, if you run yarn tsc in packages/consumer, typing information DOES seem to be available. I'm not sure if this is a TS or VSCode bug. For each TS version I tried above I ensured that VSCode was using "workspace version" and all exhibit this behavior.

🙂 Expected behavior

Typing information should be available in VSCode for both cases.

@RyanCavanaugh RyanCavanaugh added the Needs Investigation This issue needs a team member to investigate its status. label Apr 30, 2021
@RyanCavanaugh RyanCavanaugh added this to the TypeScript 4.4.0 milestone Apr 30, 2021
sheetalkamat added a commit that referenced this issue May 1, 2021
…the file when using sources of project reference

Fixes #43909
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label May 1, 2021
sheetalkamat added a commit that referenced this issue May 3, 2021
… the file when using sources of project reference (#43914)

* Test where allowJs present in referenced project affects picking up right set of import files

* use options from referened project for including resolved imports in the file when using sources of project reference
Fixes #43909
@JasonGore
Copy link
Member Author

@RyanCavanaugh @sheetalkamat I tried consuming this fix this week and am still having the same issue. I did verify it fixed my original repro, but in our repo it was still not working correctly. I narrowed it down to "strict": true being present and have updated my repro repo with a commit enabling strict and using TS 4.4.2 to reproduce, generating the errors in VS Code below. Like the original issue, the error only appears in VS Code and does not appear when running yarn tsc. There are also no compiler errors related to enabling strict, either.

image

@JasonGore
Copy link
Member Author

I wasn't sure if you'd want to reopen this issue or create a new one, as well.

@andrewbranch
Copy link
Member

New issue, please. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fix Available A PR has been opened for this issue Needs Investigation This issue needs a team member to investigate its status.
Projects
None yet
5 participants