forked from microsoft/TypeScript
/
jsdocParamTag2.errors.txt
79 lines (74 loc) · 2.56 KB
/
jsdocParamTag2.errors.txt
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
tests/cases/conformance/jsdoc/0.js(61,19): error TS2339: Property 'a' does not exist on type 'String'.
tests/cases/conformance/jsdoc/0.js(61,22): error TS2339: Property 'b' does not exist on type 'String'.
tests/cases/conformance/jsdoc/0.js(63,20): error TS8024: JSDoc '@param' tag has name 'y', but there is no parameter with that name.
==== tests/cases/conformance/jsdoc/0.js (3 errors) ====
// Object literal syntax
/**
* @param {{a: string, b: string}} obj
* @param {string} x
*/
function good1({a, b}, x) {}
/**
* @param {{a: string, b: string}} obj
* @param {{c: number, d: number}} OBJECTION
*/
function good2({a, b}, {c, d}) {}
/**
* @param {number} x
* @param {{a: string, b: string}} obj
* @param {string} y
*/
function good3(x, {a, b}, y) {}
/**
* @param {{a: string, b: string}} obj
*/
function good4({a, b}) {}
// nested object syntax
/**
* @param {Object} obj
* @param {string} obj.a - this is like the saddest way to specify a type
* @param {string} obj.b - but it sure does allow a lot of documentation
* @param {string} x
*/
function good5({a, b}, x) {}
/**
* @param {Object} obj
* @param {string} obj.a
* @param {string} obj.b - but it sure does allow a lot of documentation
* @param {Object} OBJECTION - documentation here too
* @param {string} OBJECTION.c
* @param {string} OBJECTION.d - meh
*/
function good6({a, b}, {c, d}) {}
/**
* @param {number} x
* @param {Object} obj
* @param {string} obj.a
* @param {string} obj.b
* @param {string} y
*/
function good7(x, {a, b}, y) {}
/**
* @param {Object} obj
* @param {string} obj.a
* @param {string} obj.b
*/
function good8({a, b}) {}
/**
* @param {object} obj - this type gets ignored
* @param {string} obj.a
* @param {string} obj.b - and x's type gets used for both parameters
* @param {string} x
*/
function bad1(x, {a, b}) {}
~
!!! error TS2339: Property 'a' does not exist on type 'String'.
~
!!! error TS2339: Property 'b' does not exist on type 'String'.
/**
* @param {string} y - here, y's type gets ignored but obj's is fine
~
!!! error TS8024: JSDoc '@param' tag has name 'y', but there is no parameter with that name.
* @param {{a: string, b: string}} obj
*/
function bad2(x, {a, b}) {}