glutinum-org / cli

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

`ReturnType` should point to the same type definition when a `FunctionType` return a `TypeLiteral` #145

Open MangelMaxime opened 3 weeks ago

MangelMaxime commented 3 weeks ago

Issue created from Glutinum Tool

Glutinum version - 0.11.0-preview

TypeScript

declare function f1(): { a: number; b: string };

export type T4 = ReturnType<typeof f1>;

FSharp

module rec Glutinum

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

[<AbstractClass>]
[<Erase>]
type Exports =
    [<Import("f1", "REPLACE_ME_WITH_MODULE_NAME")>]
    static member f1 () : Exports.f1 = nativeOnly

type T4 =
    T4.ReturnType

module T4 =

    [<Global>]
    [<AllowNullLiteral>]
    type ReturnType
        [<ParamObject; Emit("$0")>]
        (
            a: float,
            b: string
        ) =

        member val a : float = nativeOnly with get, set
        member val b : string = nativeOnly with get, set

module Exports =

    [<Global>]
    [<AllowNullLiteral>]
    type f1
        [<ParamObject; Emit("$0")>]
        (
            a: float,
            b: string
        ) =

        member val a : float = nativeOnly with get, set
        member val b : string = nativeOnly with get, set

Problem description

module rec Glutinum

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

[<AbstractClass>]
[<Erase>]
type Exports =
    [<Import("f1", "REPLACE_ME_WITH_MODULE_NAME")>]
    static member f1 () : Exports.f1 = nativeOnly

type T4 =
    Exports.f1

module Exports =

    [<Global>]
    [<AllowNullLiteral>]
    type f1
        [<ParamObject; Emit("$0")>]
        (
            a: float,
            b: string
        ) =

        member val a : float = nativeOnly with get, set
        member val b : string = nativeOnly with get, set