Skip to content

Commit de30e89

Browse files
Update membership.js (#1620)
Stops this error from happening: TypeError: Cannot read properties of null (reading 'name') at ThisExpression (file:///C:/Users/dev/Documents/Projects/fc-pregmod/node_modules/documentation/src/infer/membership.js:98:54) at NodePath._call (C:\Users\dev\Documents\Projects\fc-pregmod\node_modules\@babel\traverse\lib\path\context.js:46:20) at NodePath.call (C:\Users\dev\Documents\Projects\fc-pregmod\node_modules\@babel\traverse\lib\path\context.js:36:17) at NodePath.visit (C:\Users\dev\Documents\Projects\fc-pregmod\node_modules\@babel\traverse\lib\path\context.js:82:31) at TraversalContext.visitQueue (C:\Users\dev\Documents\Projects\fc-pregmod\node_modules\@babel\traverse\lib\context.js:86:16) at TraversalContext.visitSingle (C:\Users\dev\Documents\Projects\fc-pregmod\node_modules\@babel\traverse\lib\context.js:65:19) at TraversalContext.visit (C:\Users\dev\Documents\Projects\fc-pregmod\node_modules\@babel\traverse\lib\context.js:109:19) at traverseNode (C:\Users\dev\Documents\Projects\fc-pregmod\node_modules\@babel\traverse\lib\traverse-node.js:22:17) at traverse (C:\Users\dev\Documents\Projects\fc-pregmod\node_modules\@babel\traverse\lib\index.js:52:34) at NodePath.traverse (C:\Users\dev\Documents\Projects\fc-pregmod\node_modules\@babel\traverse\lib\path\index.js:101:24)
1 parent 8fcbeae commit de30e89

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/infer/membership.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,10 @@ function extractThis(path, comment) {
9191
scope = scope.parent;
9292
}
9393

94-
if (n.isClassMethod(scope.block)) {
94+
if (
95+
n.isClassMethod(scope.block) &&
96+
scope.path.parentPath.parentPath.node.id !== null
97+
) {
9598
identifiers.push(
9699
scope.path.parentPath.parentPath.node.id.name,
97100
'prototype'

0 commit comments

Comments
 (0)