File tree Expand file tree Collapse file tree 2 files changed +33
-4
lines changed Expand file tree Collapse file tree 2 files changed +33
-4
lines changed Original file line number Diff line number Diff line change @@ -51,9 +51,20 @@ export default iterateJsdoc(({
51
51
} )
52
52
53
53
// If the file is a module, concat the variables from the module scope.
54
- . concat ( scopeManager . isModule ( ) ? globalScope . childScopes [ 0 ] . variables . map ( ( variable ) => {
55
- return variable . name ;
56
- } ) : [ ] )
54
+ . concat (
55
+
56
+ // This covers `commonjs` as well as `node`
57
+ scopeManager . __options . nodejsScope ||
58
+ scopeManager . isModule ( ) ?
59
+ globalScope . childScopes . reduce ( ( arr , { variables} ) => {
60
+ // Flatten
61
+ arr . push ( ...variables ) ;
62
+
63
+ return arr ;
64
+ } , [ ] ) . map ( ( { name} ) => {
65
+ return name ;
66
+ } ) : [ ]
67
+ )
57
68
. concat ( extraTypes )
58
69
. concat ( typedefDeclarations ) ;
59
70
Original file line number Diff line number Diff line change @@ -58,7 +58,25 @@ export default {
58
58
function quux(foo) {
59
59
60
60
}
61
- `
61
+ ` ,
62
+ env : {
63
+ node : true
64
+ }
65
+ } ,
66
+ {
67
+ code : `
68
+ const MyType = require('my-library').MyType;
69
+
70
+ /**
71
+ * @param {MyType} foo - Bar.
72
+ */
73
+ function quux(foo) {
74
+
75
+ }
76
+ ` ,
77
+ env : {
78
+ node : false
79
+ }
62
80
} ,
63
81
{
64
82
code : `
You can’t perform that action at this time.
0 commit comments