bafolts / tplant

Typescript to plantuml
https://segmentationfaults.com/tplant/default.html
GNU General Public License v3.0
267 stars 34 forks source link

overloaded methods/functions are exported incorrectly #18

Closed Plagiatus closed 5 years ago

Plagiatus commented 5 years ago

I know overloading is a rather rare (and kinda hacky) thing in Typescript, but still a thing that exists. At the moment, those functions will be exported incorrectly by tplant.

Example ts

export class Test {
    move(dx: number, dy: number): string;
    move(v: Vector2): string;
    move(vordx: number | Vector2, dy?: number): string {
        return "just a test";
    }
}
export class Vector2{
    public x: number;
    public y: number;
}

What it currently looks like

@startuml
class Test {
    +move(): dx: number, dy: number): string; (v: Vector2): string; }
}
class Vector2 {
    +x: number
    +y: number
}
@enduml

What it should look like

@startuml
class Test {
    +move(dx: number, dy: number): string
    +move(v: Vector2): string
}
class Vector2 {
    +x: number
    +y: number
}
@enduml
bafolts commented 5 years ago

A fix for this is in master with https://github.com/bafolts/tplant/commit/11d90e7afc2bae382b29ae7ff5f53434a16a6c47

and will be in 2.0.5