elsassph / hxtsdgen

TypeScript declaration file generator for Haxe JavaScript output target
65 stars 12 forks source link

Update ArgsRenderer.hx. First optional argument wasn't rendered as optional in TS. #35

Closed mrEuler closed 4 years ago

mrEuler commented 4 years ago

Here is an example of how it worked before:

Haxe:

class Vec3 {
    public inline function new(x:Float = 0, y:Float = 0, z:Float = 0) {
         ...
    }
}

TypeScript Declarations:

export class Vec3 {
    constructor(x: number, y?: number, z?: number);
}

After this fix ts declarations will look like: TypeScript Declarations:

export class Vec3 {
    constructor(x?: number, y?: number, z?: number);
}
elsassph commented 4 years ago

Silly mistake...

mrEuler commented 4 years ago

I would also add some tests for functions because there were no tests for such situation