1- import { errors , ObjectUtils , SyntaxKind } from "@ts-morph/common" ;
1+ import { errors , SyntaxKind } from "@ts-morph/common" ;
22import { CodeBlockWriter } from "../../../codeBlockWriter" ;
33import { getRangeWithoutCommentsFromArray , insertIntoParentTextRange , verifyAndGetIndex } from "../../../manipulation" ;
44import { Structure } from "../../../structures" ;
55import { Constructor } from "../../../types" ;
6- import { BodyableNode , NamedNode } from "../base" ;
6+ import { BodyableNode , NamedNode , StaticableNode } from "../base" ;
77import { Node } from "../common" ;
88
99export type OverloadableNodeExtensionType = Node & BodyableNode ;
@@ -63,11 +63,12 @@ export function OverloadableNode<T extends Constructor<OverloadableNodeExtension
6363function getOverloadsAndImplementation ( node : OverloadableNodeExtensionType & OverloadableNode ) {
6464 const parent = node . getParentOrThrow ( ) ;
6565 const name = getNameIfNamedNode ( node ) ;
66+ const isStatic = getStaticIfStaticable ( node ) ;
6667 const kind = node . getKind ( ) ;
6768 return parent . forEachChildAsArray ( ) . filter ( n => {
68- const hasSameName = getNameIfNamedNode ( n ) === name ;
69- const hasSameKind = n . getKind ( ) === kind ;
70- return hasSameName && hasSameKind ;
69+ return getNameIfNamedNode ( n ) === name
70+ && n . getKind ( ) === kind
71+ && getStaticIfStaticable ( n ) === isStatic ;
7172 } ) as ( OverloadableNodeExtensionType & OverloadableNode ) [ ] ;
7273}
7374
@@ -78,6 +79,13 @@ function getNameIfNamedNode(node: Node) {
7879 return undefined ;
7980}
8081
82+ function getStaticIfStaticable ( node : Node ) {
83+ const nodeAsStaticableNode = ( node as any as StaticableNode ) ;
84+ if ( nodeAsStaticableNode . isStatic instanceof Function )
85+ return nodeAsStaticableNode . isStatic ( ) ;
86+ return false ;
87+ }
88+
8189/**
8290 * @internal
8391 */
0 commit comments