Skip to content

JSDoc does not parse type *= correctly #19985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
weswigham opened this issue Nov 13, 2017 · 1 comment
Closed

JSDoc does not parse type *= correctly #19985

weswigham opened this issue Nov 13, 2017 · 1 comment
Assignees
Labels
Bug A bug in TypeScript Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation
Milestone

Comments

@weswigham
Copy link
Member

TypeScript Version: 2.7.0-dev.201xxxxx

Code

  /**
   * @override
   * @param {symbol} eventType
   * @param {*=} eventData
   */
  dispatchEventToListeners(eventType, eventData) {
    if (!this._listeners || !this._listeners.has(eventType))
      return;

    var event = /** @type {!Common.Event} */ ({data: eventData});
    var listeners = this._listeners.get(eventType).slice(0);
    for (var i = 0; i < listeners.length; ++i)
      listeners[i].listener.call(listeners[i].thisObject, event);
  }

Expected behavior:
No errors, type for eventData is any | undefined.

Actual behavior:

front_end/common/Object.js(103,14): error TS1110: Type expected.

(A parse error on *= - a valid jsdoc type (an arity-optional anything))

@weswigham weswigham added Bug A bug in TypeScript Salsa labels Nov 13, 2017
@mhegazy mhegazy added the Domain: JSDoc Relates to JSDoc parsing and type generation label Nov 13, 2017
@mhegazy mhegazy added this to the TypeScript 2.7 milestone Nov 13, 2017
@mhegazy mhegazy modified the milestones: TypeScript 2.7, TypeScript 2.8 Jan 9, 2018
@mhegazy mhegazy modified the milestones: TypeScript 2.8, TypeScript 2.9 Mar 9, 2018
@mhegazy mhegazy modified the milestones: TypeScript 3.0, Future Jul 2, 2018
@weswigham weswigham added Domain: JavaScript The issue relates to JavaScript specifically and removed Domain: JavaScript The issue relates to JavaScript specifically Salsa labels Nov 29, 2018
@sandersn
Copy link
Member

This works in 3.6 and higher, at least.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation
Projects
None yet
Development

No branches or pull requests

3 participants