File tree 1 file changed +11
-3
lines changed 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change 1
1
The below code outlines which constructs are currently supported or not supported
2
2
when using JsDoc annotations to provide type information in JavaScript files.
3
3
4
- Note any tags which are not explicitly listed below (such as ` @typedef ` , or ` @ constructor` )
4
+ Note any tags which are not explicitly listed below (such as ` @constructor ` )
5
5
are not yet supported.
6
6
7
7
``` javascript
8
8
// === Supported ===
9
9
10
10
// You can use the "@type" tag and reference a type name (either primitive,
11
- // or defined in a TypeScript declaration)
11
+ // defined in a TypeScript declaration, or in a JSDoc "@typedef" tag )
12
12
/**
13
13
* @type {string}
14
14
*/
@@ -57,11 +57,19 @@ var var7;
57
57
var var8;
58
58
59
59
60
- // An object specification may also be using within the braces
60
+ // An object specification may also be used within the braces
61
61
// For example, an object with properties 'a' (string) and 'b' (number)
62
62
/** @type {{a: string, b: number}} */
63
63
var var9;
64
64
65
+ // "@typedef" maybe used to define complex types
66
+ /**
67
+ * @typedef {Object} SpecialType - creates a new type named 'SpecialType'
68
+ * @property {string} prop1 - a string property of SpecialType
69
+ * @property {number} prop2 - a number property of SpecialType
70
+ */
71
+ /** @type {SpecialType} */
72
+ var specialTypeObject;
65
73
66
74
// Parameters may be declared in a variety of syntactic forms
67
75
You can’t perform that action at this time.
0 commit comments