@@ -128,6 +128,18 @@ const isNodeExportedOrPublic = (node: Node): boolean => {
128128 ) ;
129129} ;
130130
131+ /**
132+ * True if node is a method or property and is declaration is static.
133+ */
134+ const isNodeStatic = ( node : Node ) : boolean | undefined => {
135+ if ( ! isMethodDeclaration ( node ) && ! isPropertyDeclaration ( node ) ) {
136+ return undefined ;
137+ }
138+
139+ const flags = getCombinedModifierFlags ( node as Declaration ) ;
140+ return ( flags & ModifierFlags . Static ) !== 0 ;
141+ } ;
142+
131143/** Serialize a signature (call or construct) */
132144const serializeSignature = ( {
133145 checker,
@@ -274,17 +286,22 @@ const visit = ({
274286 const addDocEntry = ( {
275287 symbol,
276288 doc_type,
289+ isStatic,
277290 node
278291 } : {
279292 symbol : TypeScriptSymbol | undefined ;
280293 doc_type : DocEntryType ;
281294 node : Node ;
282- } ) : void => {
295+ } & Pick < DocEntry , 'isStatic' > ) : void => {
283296 if ( ! symbol ) {
284297 return ;
285298 }
286299
287- const details = serializeSymbol ( { checker, symbol, doc_type} ) ;
300+ const details = {
301+ ...serializeSymbol ( { checker, symbol, doc_type} ) ,
302+ isStatic
303+ } ;
304+
288305 pushEntry ( { node, details} ) ;
289306 } ;
290307
@@ -335,7 +352,8 @@ const visit = ({
335352 forEachChild ( node , visitChild ) ;
336353 } else if ( isMethodDeclaration ( node ) ) {
337354 const symbol = checker . getSymbolAtLocation ( node . name ) ;
338- addDocEntry ( { symbol, doc_type : 'method' , node} ) ;
355+ const isStatic = isNodeStatic ( node ) ;
356+ addDocEntry ( { symbol, doc_type : 'method' , isStatic, node} ) ;
339357 } else if ( isFunctionDeclaration ( node ) ) {
340358 const symbol = checker . getSymbolAtLocation ( node . name ?? node ) ;
341359 addDocEntry ( { symbol, doc_type : 'function' , node} ) ;
@@ -365,7 +383,8 @@ const visit = ({
365383 } else if ( isPropertyDeclaration ( node ) ) {
366384 // We test for the property after the arrow function because a public property of a class can be an arrow function.
367385 const symbol = checker . getSymbolAtLocation ( node . name ) ;
368- addDocEntry ( { symbol, doc_type : 'property' , node} ) ;
386+ const isStatic = isNodeStatic ( node ) ;
387+ addDocEntry ( { symbol, doc_type : 'property' , isStatic, node} ) ;
369388 } else if ( isVariableStatement ( node ) ) {
370389 const {
371390 declarationList : { declarations, flags}
0 commit comments