google / google/closure-compiler

@typedef and @template don't work together

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

Description

The following code does not work:

``` js
/**
* @template S, T
* @typedef {{
* type: string,
* humanName: string,
* keyboard: TriResourceRef,
* serverElems: Array.,
* getSrvId: function(S): string,
* getTitle: function(S): string,
* getDescriptions: function(S): Array.,
* getUseForGrouping: function(S): boolean,
* getDeleted: function(S): boolean,
* getCliId: function(T): string,
* convertToSrv: function(T): S,
* convertToCli: function(S): T,
* makeNewCli: function(string, Date): T,
* mergeSrvCli: function(S, T): S,
* getUpdateId: function(T): string,
* isSent: function(T): boolean,
* insertDescriptionIfMissing: function(S): S
* }}
*/
var DrgInterf;
```

Using the recent compiler version, it results this:

```
/var/folders/m0/8vx31n6j775g80_0pqhh47k40000gn/T/tmpbDmD3e:77568: ERROR - Bad type annotation. Unknown type S
* serverElems: Array.,
^
```

Splitting the template in two template annotations does not help either.

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.