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

47 lines
783 B
TypeScript
Raw Normal View History

2017-05-26 05:16:52 +02:00
// @allowJS: true
// @suppressOutputPathCheck: true
// @filename: 0.js
// @ts-check
/**
* @typedef {Object} Opts
* @property {string} x
* @property {string=} y
2017-05-26 07:35:15 +02:00
* @property {string} [z]
* @property {string} [w="hi"]
2017-05-30 06:48:34 +02:00
*
2017-05-26 05:16:52 +02:00
* @param {Opts} opts
*/
2017-05-30 06:48:34 +02:00
function foo(opts) {
opts.x;
}
2017-05-26 05:16:52 +02:00
2017-05-28 04:11:08 +02:00
foo({x: 'abc'});
/**
* @typedef {Object} AnotherOpts
* @property anotherX {string}
* @property anotherY {string=}
*
* @param {AnotherOpts} opts
*/
function foo1(opts) {
opts.anotherX;
}
foo1({anotherX: "world"});
2017-05-28 04:11:08 +02:00
2017-05-30 06:48:34 +02:00
/**
* @typedef {object} Opts1
* @property {string} x
* @property {string=} y
* @property {string} [z]
* @property {string} [w="hi"]
*
* @param {Opts1} opts
*/
function foo2(opts) {
2017-05-30 06:48:34 +02:00
opts.x;
}
foo2({x: 'abc'});