Skip to content

Chained assignment breaks jsdoc type lookup #22434

@sandersn

Description

@sandersn
// @noEmit: true
// @allowJs: true
// @checkJs: true
// @Filename: a.js

function A () {
    this.x = 1
}
/** @param {number} n */
A.prototype.y = A.prototype.z = function (n) {
    return n + this.x
}
var a = new A()

Expected behavior:
a.y : (n: number) => number and a.z: (n: number) => number.

Actual behavior:
a.y : (n: any) => any and a.z: (n: any) => any.

Note that binding works fine; it's just jsdoc type lookup that is defeated by chained assignment. Chained assignment of statics breaks in the same way as prototype assignments.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions