You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+19-10Lines changed: 19 additions & 10 deletions
Original file line number
Diff line number
Diff line change
@@ -10,23 +10,14 @@ JSDoc accepts plugins by simply installing their npm package:
10
10
11
11
To configure JSDoc to use the plugin, add the following to the JSDoc configuration file, e.g. `conf.json`:
12
12
13
-
```json
13
+
```jsonc
14
14
"plugins": [
15
15
"jsdoc-plugin-typescript"
16
16
],
17
-
"typescript": {
18
-
"moduleRoot": "src"
19
-
}
20
17
```
21
18
22
19
See http://usejsdoc.org/about-configuring-jsdoc.html for more details on how to configure JSDoc.
23
20
24
-
In the above snippet, `"src"` is the directory that contains the source files. Inside that directory, each `.js` file needs a `@module` annotation with a path relative to that `"moduleRoot"`, e.g.
25
-
26
-
```js
27
-
/**@moduleol/proj **/
28
-
```
29
-
30
21
## What this plugin does
31
22
32
23
When using the `class` keyword for defining classes (required by TypeScript), JSDoc requires `@classdesc` and `@extends` annotations. With this plugin, no `@classdesc` and `@extends` annotations are needed.
@@ -40,31 +31,36 @@ TypeScript and JSDoc use a different syntax for imported types. This plugin conv
@@ -89,26 +87,37 @@ are removed because they make JSDoc stop inheritance
89
87
This syntax is also used when referring to types of `@typedef`s and `@enum`s.
90
88
91
89
**Anonymous default export:**
90
+
92
91
```js
93
92
/**
94
93
* @type{module:path/to/module}
95
94
*/
96
95
```
97
96
98
97
**typeof type:**
98
+
99
99
```js
100
100
/**
101
101
* @type{Class<module:path/to/module.exportName>}
102
102
*/
103
103
```
104
104
105
105
**Template literal type**
106
+
106
107
```js
107
108
/**
108
109
* @type{'static:${dynamic}'}
109
110
*/
110
111
```
111
112
113
+
## Module id resolution
114
+
115
+
For resolving module ids, this plugin mirrors the method used by JSDoc:
116
+
117
+
1. Parse the referenced module for an `@module` tag.
118
+
2. If a tag is found and it has an explicit id, use that.
119
+
3. If a tag is found, but it doesn't have an explicit id, use the module's file path relative to the nearest shared parent directory, and remove the file extension.
120
+
112
121
## Contributing
113
122
114
123
If you are interested in making a contribution to the project, please see the [contributing page](./contributing.md) for details on getting your development environment set up.
0 commit comments