google / google/closure-compiler

getJsDocInfo for typedef'ed types returns the jsdoc of the last usage site.

Open
#1,975 0 comments 0 reactions 0 assignees View on GitHub
Types
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

Consider the following snippet:

``` javascript
/**
* @export
* @constructor
*/
typedef.C = function() {
/**
* The js doc attached to typedef.C.T type.
*
* @private
* @type {typedef.C.T}
*/
this.privateUsage = function() {};
};

/**
* The jsDoc we want, but can't obtain.
*
* @typedef {function(?):?}
*/
typedef.C.T;
```

When using the compiler apis for a custom pass, `typeRegistry.getType('typedef.C.T').getJsDocInfo()` returns the js doc on `this.privateUsage`, not the js doc at the typedef declaration site.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.