Skip to content

JSDoc Typedef should pull name from attached property if missing #19983

Closed
@weswigham

Description

@weswigham

TypeScript Version: 2.7.0-dev.201xxxxx

Code

/** @typedef {{ title: string, colors: !Array.<string>, mutable: boolean }} */
ColorPicker.Spectrum.Palette;

// ...later
ColorPicker.Spectrum.PaletteGenerator = class {
  /**
   * @param {function(!ColorPicker.Spectrum.Palette)} callback
   */
  constructor(callback) {
    this._callback = callback;
    /** @type {!Map.<string, number>} */
    this._frequencyMap = new Map();
    var stylesheetPromises = [];
    for (var cssModel of SDK.targetManager.models(SDK.CSSModel)) {
      for (var stylesheet of cssModel.allStyleSheets())
        stylesheetPromises.push(this._processStylesheet(stylesheet));
    }
    Promise.all(stylesheetPromises).catchException(null).then(this._finish.bind(this));
  }
}

Expected behavior:
ColorPicker.Spectrum.Palette is effectively a type alias for the type in the typedef.

Actual behavior:

front_end/color_picker/Spectrum.js(836,77): error TS1003: Identifier expected.

(A parse error on the trailing * of the typedef).

This is used everywhere in the chrome devtools codebase.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationDomain: JavaScriptThe issue relates to JavaScript specifically

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions