Page MenuHomePhabricator

jsdoc-wmf-theme: Bounded generic types misinterpreted
Open, MediumPublicBUG REPORT

Description

Generics are very useful but often it is necessary to place some type limitation on them. These work fine with stock JSDoc but cause the JSDoc WMF theme link validator to fail as the type is "eaten" instead of the name. E.g., the following input:

/**
 * @template {string} T
 * @param {T} str
 * @return {T}
 */
function identity( str ) {
	return str;
}

Produces:

WARNING: Unknown link T in identity
WARNING: Unknown link T in Global
WARNING: Unknown link T in Global

Which is an error when pedantic mode is enabled.

An isolated and complete test case is available.

Event Timeline

Krinkle renamed this task from [Bug] Bounded generic types misinterpreted to jsdoc-wmf-theme: Bounded generic types misinterpreted.Sep 9 2020, 12:40 PM
Krinkle triaged this task as Medium priority.
Krinkle moved this task from Backlog to Confirmed Problem on the JSDoc WMF theme board.