microsoft / microsoft/TypeScript
jsDoc intellisense support for @typedef in another file
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Issue Type: Feature Request
Intellisense uses @typedef tags in other files but only if the file is opened in current window. Please allow any typedef tag to be used inside current working directory even if file containing typedef is not opened.
Here is what i mean. I annotated a variable with type. This variable is exported directly with module.exports.

My typedef is in seperate file.
Configuration.js
/**
* @typedef {Object} ConfigurationInputDirectories
* @property {string} modules
* @property {string} layoutModules
* @property {string} standaloneScripts
* @property {string} standaloneStyles
* @property {string} libraryScripts
* @property {string} libraryStyles
* @property {string} markupTemplates
*/
/**
* @typedef {Object} ConfigurationOutputDirectories
* @property {string} pageScripts
* @property {string} vendorScripts
* @property {string} standaloneScripts
* @property {string} pageStyles
* @property {string} vendorStyles
* @property {string} standaloneStyles
* @property {string} markupFiles
*/
/**
* @typedef {Object} ConfigurationVendor
* @property {string} standardPath
* @property {string} minPath
*/
/**
* @typedef {Object} ConfigurationModule
* @property {string} layoutModule
* @property {string} markupTemplate
* @property {string[]} includeStandaloneScripts
* @property {string[]} includeStandaloneStyles
* @property {string[]} includeVendorScripts
* @property {string[]} includeVendorStyles
* @property {string[]} excludeStandaloneScripts
* @property {string[]} excludeStandaloneStyles
* @property {string[]} excludeVendorScripts
* @property {string[]} excludeVendorStyles
*/
/**
* @typedef {Object} ConfigurationLayoutModule
* @property {string} layoutModule
* @property {string} markupTemplate
* @property {string[]} includeStandaloneScripts
* @property {string[]} includeStandaloneStyles
* @property {string[]} includeVendorScripts
* @property {string[]} includeVendorStyles
* @property {string[]} excludeStandaloneScripts
* @property {string[]} excludeStandaloneStyles
* @property {string[]} excludeVendorScripts
* @property {string[]} excludeVendorStyles
*/
/**
* Represents configuration object for build process.
* @typedef {Object} Configuration
* @property {ConfigurationInputDirectories} inputDirectories
* @property {ConfigurationOutputDirectories} outputDirectories
* @property {Object.<string,ConfigurationVendor} vendorScripts
* @property {Object.<string,ConfigurationVendor>} vendorStyles
* @property {Object.<string,ConfigurationModule>} modules
* @property {Object.<string,ConfigurationLayoutModule>} layoutModules
* @property {string} defaultMarkupTemplate
* @property {string} contentPlaceHolder
* @property {string} nameDirectorySeperator
* @property {string[]} validLibraryEntryFileNames
* @property {string} moduleFileName
* @property {string} rootModuleFileName
* @property {string} systemjsPath
* @property {string} systemjsNamedRegistersPath
*/
When this file containing type definitions is open the intellisense/language service/or whatever you call it is recognizing this variable's type and intellisense displays the members when using this config variable. But when file is closed its type turns to any. It would be nice to see type informations from typedef tags even if files containing tags are closed.

VS Code version: Code 1.33.0 (0dd516dd412d42323fc3464531b1c715d51c4c1a, 2019-04-04T15:14:28.026Z)
OS version: Windows_NT x64 10.0.17134
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the issue with the provided Configuration.js typedefs and a separate module.exports consumer, first with the typedef file open and then closed. Trace the JavaScript language service's JSDoc @typedef discovery and make the consumer resolve those types across the current working directory; done means IntelliSense shows the typedef members in both cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, typescript
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100