Skip to content

TypeScript method overload issue #82

@mohbl

Description

@mohbl

Method overloading in TypeScript allows a class, interface, or namespace to define multiple methods with the same name but different parameter lists or types, enabling reuse of the method name for different purposes. overloaded methods are represented by multiple signature declarations (aliases) and a single implementation declaration. For example, a class may expose several overloaded forms of a method such as compute(x: number): number, compute(x:string, y: number): string, and compute(x: boolean): boolean, but only one concrete implementation compute(x: number | string | boolean, y?: number): number | string | boolean actually exists in the source code.

Conceptually, as shown in the attached figure explains that invocations of such a method may be associated either with the specific overload signature (alias MethodSignature) or directly with the implementation declaration ( MethodDeclaration ). However, the current importer for overloaded methods with an implementation, invocations link to the class as the receiver instead of to the method (alias or implementation). This misrepresentation breaks the expected Famix behavior, where an Invocation should reference a Method rather than a Class, and consequently prevents correct visualization and analysis in Moose. The issue was identified late during the internship.

Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions