Skip to content

@typedef and @template don't work together #890

@agrafix

Description

@agrafix

The following code does not work:

/**
 * @template S, T
 * @typedef {{
 *             type: string,
 *             humanName: string,
 *             keyboard: TriResourceRef,
 *             serverElems: Array.<S>,
 *             getSrvId: function(S): string,
 *             getTitle: function(S): string,
 *             getDescriptions: function(S): Array.<string>,
 *             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.<S>,
                                   ^

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions