2018-07-17 19:02:51 +02:00
|
|
|
// @checkJs: true
|
|
|
|
// @allowJs: true
|
|
|
|
// @noEmit: true
|
|
|
|
// @Filename: test.js
|
|
|
|
// @strict: true
|
|
|
|
/** @typedef {{
|
|
|
|
status: 'done'
|
|
|
|
m(n: number): void
|
|
|
|
}} DoneStatus */
|
|
|
|
|
|
|
|
// property assignment
|
|
|
|
var ns = {}
|
|
|
|
/** @type {DoneStatus} */
|
|
|
|
ns.x = {
|
|
|
|
status: 'done',
|
|
|
|
m(n) { }
|
|
|
|
}
|
|
|
|
|
|
|
|
ns.x = {
|
|
|
|
status: 'done',
|
|
|
|
m(n) { }
|
|
|
|
}
|
|
|
|
ns.x
|
|
|
|
|
|
|
|
|
|
|
|
// this-property assignment
|
|
|
|
class Thing {
|
|
|
|
constructor() {
|
|
|
|
/** @type {DoneStatus} */
|
|
|
|
this.s = {
|
|
|
|
status: 'done',
|
|
|
|
m(n) { }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fail() {
|
|
|
|
this.s = {
|
|
|
|
status: 'done',
|
|
|
|
m(n) { }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// exports-property assignment
|
|
|
|
|
|
|
|
/** @type {DoneStatus} */
|
|
|
|
exports.x = {
|
|
|
|
status: "done",
|
|
|
|
m(n) { }
|
|
|
|
}
|
|
|
|
exports.x
|
|
|
|
|
2018-07-20 19:59:26 +02:00
|
|
|
/** @type {DoneStatus} */
|
2018-07-17 19:02:51 +02:00
|
|
|
module.exports.y = {
|
|
|
|
status: "done",
|
|
|
|
m(n) { }
|
|
|
|
}
|
|
|
|
module.exports.y
|
|
|
|
|
|
|
|
// prototype-property assignment
|
|
|
|
/** @type {DoneStatus} */
|
|
|
|
Thing.prototype.x = {
|
|
|
|
status: 'done',
|
|
|
|
m(n) { }
|
|
|
|
}
|
|
|
|
Thing.prototype.x
|
|
|
|
|
|
|
|
// prototype assignment
|
|
|
|
function F() {
|
|
|
|
}
|
|
|
|
/** @type {DoneStatus} */
|
|
|
|
F.prototype = {
|
|
|
|
status: "done",
|
|
|
|
m(n) { }
|
|
|
|
}
|
|
|
|
|
|
|
|
// @Filename: mod.js
|
|
|
|
// module.exports assignment
|
|
|
|
/** @type {{ status: 'done', m(n: number): void }} */
|
|
|
|
module.exports = {
|
|
|
|
status: "done",
|
|
|
|
m(n) { }
|
|
|
|
}
|