1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41
|
tests/cases/conformance/jsdoc/a.js(12,21): error TS2339: Property 'x' does not exist on type 'typeof A'.
tests/cases/conformance/jsdoc/a.js(15,5): error TS2345: Argument of type '"no"' is not assignable to parameter of type 'number'.
tests/cases/conformance/jsdoc/a.js(16,5): error TS2345: Argument of type '"not really"' is not assignable to parameter of type 'number'.
tests/cases/conformance/jsdoc/a.js(17,5): error TS2345: Argument of type '"still no"' is not assignable to parameter of type 'number'.
tests/cases/conformance/jsdoc/a.js(18,5): error TS2345: Argument of type '"not here either"' is not assignable to parameter of type 'number'.
tests/cases/conformance/jsdoc/a.js(19,1): error TS2322: Type '10' is not assignable to type '1'.
==== tests/cases/conformance/jsdoc/a.js (6 errors) ====
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
~
!!! error TS2339: Property 'x' does not exist on type 'typeof A'.
}
var a = new A()
a.y('no') // error
~~~~
!!! error TS2345: Argument of type '"no"' is not assignable to parameter of type 'number'.
a.z('not really') // error
~~~~~~~~~~~~
!!! error TS2345: Argument of type '"not really"' is not assignable to parameter of type 'number'.
A.s('still no') // error
~~~~~~~~~~
!!! error TS2345: Argument of type '"still no"' is not assignable to parameter of type 'number'.
A.t('not here either') // error
~~~~~~~~~~~~~~~~~
!!! error TS2345: Argument of type '"not here either"' is not assignable to parameter of type 'number'.
a.first = 10 // error: '10' isn't assignable to '1'
~~~~~~~
!!! error TS2322: Type '10' is not assignable to type '1'.
|