|
| 1 | +tests/cases/conformance/jsdoc/0.js(3,20): error TS8024: JSDoc '@param' tag has name 'unrelated', but there is no parameter with that name. |
| 2 | + |
| 3 | + |
| 4 | +==== tests/cases/conformance/jsdoc/0.js (1 errors) ==== |
| 5 | + /** |
| 6 | + * @param {Object} notSpecial |
| 7 | + * @param {string} unrelated - not actually related because it's not notSpecial.unrelated |
| 8 | + ~~~~~~~~~ |
| 9 | +!!! error TS8024: JSDoc '@param' tag has name 'unrelated', but there is no parameter with that name. |
| 10 | + */ |
| 11 | + function normal(notSpecial) { |
| 12 | + notSpecial; // should just be 'any' |
| 13 | + } |
| 14 | + normal(12); |
| 15 | + |
| 16 | + /** |
| 17 | + * @param {Object} opts1 doc1 |
| 18 | + * @param {string} opts1.x doc2 |
| 19 | + * @param {string=} opts1.y doc3 |
| 20 | + * @param {string} [opts1.z] doc4 |
| 21 | + * @param {string} [opts1.w="hi"] doc5 |
| 22 | + */ |
| 23 | + function foo1(opts1) { |
| 24 | + opts1.x; |
| 25 | + } |
| 26 | + |
| 27 | + foo1({x: 'abc'}); |
| 28 | + |
| 29 | + /** |
| 30 | + * @param {Object[]} opts2 |
| 31 | + * @param {string} opts2[].anotherX |
| 32 | + * @param {string=} opts2[].anotherY |
| 33 | + */ |
| 34 | + function foo2(/** @param opts2 bad idea theatre! */opts2) { |
| 35 | + opts2[0].anotherX; |
| 36 | + } |
| 37 | + |
| 38 | + foo2([{anotherX: "world"}]); |
| 39 | + |
| 40 | + /** |
| 41 | + * @param {object} opts3 |
| 42 | + * @param {string} opts3.x |
| 43 | + */ |
| 44 | + function foo3(opts3) { |
| 45 | + opts3.x; |
| 46 | + } |
| 47 | + foo3({x: 'abc'}); |
| 48 | + |
| 49 | + /** |
| 50 | + * @param {object[]} opts4 |
| 51 | + * @param {string} opts4[].x |
| 52 | + * @param {string=} opts4[].y |
| 53 | + * @param {string} [opts4[].z] |
| 54 | + * @param {string} [opts4[].w="hi"] |
| 55 | + */ |
| 56 | + function foo4(opts4) { |
| 57 | + opts4[0].x; |
| 58 | + } |
| 59 | + |
| 60 | + foo4([{ x: 'hi' }]); |
| 61 | + |
| 62 | + /** |
| 63 | + * @param {object[]} opts5 - Let's test out some multiple nesting levels |
| 64 | + * @param {string} opts5[].help - (This one is just normal) |
| 65 | + * @param {object} opts5[].what - Look at us go! Here's the first nest! |
| 66 | + * @param {string} opts5[].what.a - (Another normal one) |
| 67 | + * @param {Object[]} opts5[].what.bad - Now we're nesting inside a nested type |
| 68 | + * @param {string} opts5[].what.bad[].idea - I don't think you can get back out of this level... |
| 69 | + * @param {boolean} opts5[].what.bad[].oh - Oh ... that's how you do it. |
| 70 | + * @param {number} opts5[].unnest - Here we are almost all the way back at the beginning. |
| 71 | + */ |
| 72 | + function foo5(opts5) { |
| 73 | + opts5[0].what.bad[0].idea; |
| 74 | + opts5[0].unnest; |
| 75 | + } |
| 76 | + |
| 77 | + foo5([{ help: "help", what: { a: 'a', bad: [{ idea: 'idea', oh: false }] }, unnest: 1 }]); |
| 78 | + |
0 commit comments