glutinum-org / cli

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

Union of literal types should generate an interface and not an union type #93

Closed MangelMaxime closed 4 months ago

MangelMaxime commented 5 months ago

Issue created from Glutinum Tool

Glutinum version - 0.5.0

TypeScript

type Content = { html: string } | { markdown: string }

FSharp

module rec Glutinum

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

type Content =
    U2<obj, obj>

Problem description

Should generates

[<AllowNullLiteral>]
[<Interface>]
type Content =
    abstract member html: string with get, set
    abstract member markdown: string with get, set

Typescript snippet to validate this hypothesis

type Test = { html: string } | { markdown: string }

const test : Test = {
    html: 'html',
    markdown: 'markdown'
};