TypeScript/tests/cases/conformance/jsdoc/jsdocTypeFromChainedAssignment.ts
Nathan Shively-Sanders 6d9a8250bd
Improve binding and jsdoc of chained special js assignments (#23038)
* Search for jsdoc on chained assignments

* Fix binding of chained binary expression js-assignments

* Test:chained jsdoc+chained prototype assignment

* Improve naming
2018-04-02 09:47:01 -07:00

25 lines
528 B
TypeScript

// @noEmit: true
// @allowJs: true
// @checkJs: true
// @noImplicitAny: true
// @Filename: a.js
function A () {
this.x = 1
/** @type {1} */
this.first = this.second = 1
}
/** @param {number} n */
A.prototype.y = A.prototype.z = function f(n) {
return n + this.x
}
/** @param {number} m */
A.s = A.t = function g(m) {
return m + this.x
}
var a = new A()
a.y('no') // error
a.z('not really') // error
A.s('still no') // error
A.t('not here either') // error
a.first = 10 // error: '10' isn't assignable to '1'