Skip to content

Project does not contain document for @types with TS 2.4 #17131

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
mjbvz opened this issue Jul 12, 2017 · 8 comments
Closed

Project does not contain document for @types with TS 2.4 #17131

mjbvz opened this issue Jul 12, 2017 · 8 comments
Labels
Fixed A PR has been merged for this issue VS Code Tracked There is a VS Code equivalent to this issue

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Jul 12, 2017

From microsoft/vscode#30463

TypeScript Version: 2.4.1

Code

  1. Download this project and opened it in vscode: https://github.com/Microsoft/vscode/files/1142617/example.zip
  2. Open file1.js and trigger completions.
  3. Then open broken.js and try trigger completions

Bug

Trace  - 10:18:13 AM] Response received: completions (24). Request took 2 ms. Success: false . Message: Error processing request. Project '/dev/null/inferredProject1*' does not contain document '/users/matb/library/caches/typescript/2.4/node_modules/parse5/node_modules/@types/node/index.d.ts'
Error: Project '/dev/null/inferredProject1*' does not contain document '/users/matb/library/caches/typescript/2.4/node_modules/parse5/node_modules/@types/node/index.d.ts'
    at Object.ThrowProjectDoesNotContainDocument (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:75718:23)
    at InferredProject.Project.getScriptInfoForNormalizedPath (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:77238:42)
    at InferredProject.Project.getScriptInfo (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:77243:29)
    at ModuleBuilder.AbstractBuilder.getOrCreateFileInfo (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:76551:51)
    at /Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:76679:84
    at Object.map (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:1483:29)
    at ModuleBuilder.getReferencedFileInfos (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:76679:31)
    at ModuleBuilder.updateFileReferences (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:76708:42)
    at ModuleBuilder.ensureProjectDependencyGraphUpToDate (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:76693:30)
    at ModuleBuilder.onProjectUpdateGraph (/Applications/Visual Studio Code - Insiders.app/Contents/Resources/app/extensions/node_modules/typescript/lib/tsserver.js:76684:22)
@mjbvz mjbvz added the VS Code Tracked There is a VS Code equivalent to this issue label Jul 12, 2017
@mjbvz mjbvz changed the title Project does not contain document errors with TS 2.4 Project does not contain document for @types with TS 2.4 Jul 12, 2017
@mjbvz
Copy link
Contributor Author

mjbvz commented Jul 12, 2017

This issue has also been reported here: microsoft/vscode#30425 (comment)

@ghost
Copy link

ghost commented Jul 14, 2017

I need to use TS2.4 to reproduce this due to #17138.
Can reproduce this with just a JS file containing: require("jsdom").

My hypothesis is that this is because parse5 (a dependency of jsdom) has a dependency on @types/node version 6, while the latest version is 8, causing those types to be stored in typescript/2.4/node_modules/parse5/node_modules/@types/node/index.d.ts instead of typescript/2.4/node_modules/@types/node/index.d.ts. Somewhere we must be assuming that the node_modules cache is flat.

Can't reproduce it with just require("parse5"); presumably because we need 2 versions of @types/node in existence to trigger the error.

The error is likely that in getReferencedFileInfos getReferencedFiles to get all referenced files, which for parse5 will include its node_modules/@types. We then call getOrCreateFileInfo, which calls getScriptInfo. getScriptInfo calls getOrCreateScriptInfoForNormalizedPath, but then asserts that the result must already be attached to this project, so it must be expecting to just have gotten an existing scriptInfo and not created one.

@mjbvz
Copy link
Contributor Author

mjbvz commented Jul 14, 2017

Thanks for looking into this @Andy-MS!

@rbuckton We're seeing a number of users reporting this in a variety of different cases. Can we please prioritize this for TS 2.4.2

@ghost
Copy link

ghost commented Jul 17, 2017

Talked to @sheetalkamat and it looks like this was fixed by #16539.
Now that #17210 is in there should be nothing blocking me from reproducing this in master, but I can't.

@ghost ghost closed this as completed Jul 17, 2017
@rbuckton
Copy link
Contributor

This does look to have been fixed by #16539. I've merged this into release-2.4.

@kscott5
Copy link

kscott5 commented Jul 19, 2017

Yes I review must of the other related threads but this is still an issue for me.

The latest build of VS Code with TypeScript 2.4.1, Express and MongoDB only has partial Intellisense enabled for the modules imported via the .ts file. TypeScript adds Express and MongoDB index.d.ts files to its @types folder there's very little documentation available. If you can image, this reduces my productivity dramatically. Any suggestions on resolving this. My repo is Rescue Shelter

Also, is there anyway to include the actual JSDoc located in the node_module folder specifically?

@ghost
Copy link

ghost commented Jul 19, 2017

@kscott5 Can you try this out with typescript@next? See the docs for how to set that up.

@kscott5
Copy link

kscott5 commented Jul 19, 2017

I will review the document. I did find this post on Angular University blog. It brief explain @type declaration and why the suggest using the noImplicityAny: true flag updated in tsconfig.json, and although it didn't resolve the issue complete it helped.

MODIFIED:
@Andy-MS Thank you for the suggestion. Both provided the information I needed and gave me a few minutes to refocus and review my code. I'm working!

@DanielRosenwasser DanielRosenwasser added the Fixed A PR has been merged for this issue label Jul 28, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Fixed A PR has been merged for this issue VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

4 participants