TypeScript/tests/cases/conformance/jsdoc/checkJsdocTypeTagOnObjectProperty2.ts

27 lines
550 B
TypeScript
Raw Normal View History

2017-05-31 21:15:50 +02:00
// @allowJS: true
// @suppressOutputPathCheck: true
// @strictNullChecks: true
// @filename: 0.js
// @ts-check
2017-05-31 22:13:25 +02:00
var lol;
2017-05-31 21:15:50 +02:00
const obj = {
/** @type {string|undefined} */
bar: 42,
/** @type {function(number): number} */
method1(n1) {
2017-05-31 22:13:25 +02:00
return "42";
2017-05-31 21:15:50 +02:00
},
2017-05-31 22:13:25 +02:00
/** @type {function(number): number} */
method2: (n1) => "lol",
2017-06-14 00:24:05 +02:00
/** @type {function(number): number} */
arrowFunc: (num="0") => num + 42,
2017-05-31 21:15:50 +02:00
/** @type {string} */
lol
}
2017-05-31 22:13:25 +02:00
lol = "string"
/** @type {string} */
2017-06-14 00:24:05 +02:00
var s = obj.method1(0);
/** @type {string} */
var s1 = obj.method2("0");