glutinum-org / cli

Home Page:https://glutinum.net/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

MangelMaxime opened this issue · comments

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'
};