glutinum-org / cli

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

function value overload incorrectly generates duplicate Invoke definition #161

Open joprice opened 1 day ago

joprice commented 1 day ago

Issue created from Glutinum Tool

Glutinum version - 0.11.0-preview

TypeScript

  export declare const injectStore: {
      <State = any>(storeFactory: State | ((hydration?: State) => Store<State>), config?: InjectStoreConfig): Store<State>;
      <State = undefined>(): Store<State>;
  };

FSharp

module rec Glutinum

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

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

module Exports =

    [<Global>]
    [<AllowNullLiteral>]
    type injectStore
        [<ParamObject; Emit("$0")>]
        (
            Invoke: Store<'State>,
            Invoke: Store<'State>
        ) =

        member val Invoke : Store<'State> = nativeOnly with get, set
        member val Invoke : Store<'State> = nativeOnly with get, set

Problem description

When a top level exported function has multiple overloads, the definition looks like an object literal type instead of a function. I can't seem to find docs on this feature, but it's used frequency in the zedux library, for instance in @zedux/atoms/dist/cjs/injectors/injectStore.d.ts.