glutinum-org / cli

https://glutinum.net/
59 stars 6 forks source link

Invalid code generated when a spread is used in a member signature #116

Closed MangelMaxime closed 2 months ago

MangelMaxime commented 4 months ago

Issue created from Glutinum Tool

Glutinum version - 0.9.0-preview

TypeScript

export class Signature {
    private _fromData;
    toSVG({ includeBackgroundColor }?: ToSVGOptions): string;
}

FSharp

module rec Glutinum

open Fable.Core
open Fable.Core.JsInterop
open System

[<AbstractClass>]
[<Erase>]
type Exports =
    [<Import("Signature", "REPLACE_ME_WITH_MODULE_NAME"); EmitConstructor>]
    static member Signature () : Signature = nativeOnly

[<AllowNullLiteral>]
[<Interface>]
type Signature =
    abstract member toSVG: ?{ includeBackgroundColor }: ToSVGOptions -> string

Problem description

We should just generate something like

module rec Glutinum

open Fable.Core
open Fable.Core.JsInterop
open System

[<AbstractClass>]
[<Erase>]
type Exports =
    [<Import("Signature", "REPLACE_ME_WITH_MODULE_NAME"); EmitConstructor>]
    static member Signature () : Signature = nativeOnly

[<AllowNullLiteral>]
[<Interface>]
type Signature =
    abstract member toSVG: arg1: ToSVGOptions -> string

TODO: Handle the case where such a transformation is applied to several arguments (arg1, arg2, etc.)