module rec Glutinum
open Fable.Core
open Fable.Core.JsInterop
open System
[<AllowNullLiteral>]
[<Interface>]
type SplitAtomAction =
abstract member ``type``: string with get, set
abstract member atom: PrimitiveAtom<'Item> with get, set
abstract member ``type``: string with get, set
abstract member value: 'Item with get, set
abstract member before: PrimitiveAtom<'Item> option with get, set
abstract member ``type``: string with get, set
abstract member atom: PrimitiveAtom<'Item> with get, set
abstract member before: PrimitiveAtom<'Item> option with get, set
Problem description
The pattern in typescript of using a union of object types that share a singleton typed discriminator field ends up generating an fsharp type with the union of all fields, including duplicates. This could either be detected by finding the intersection of fields in the union, then checking if they are the same type and if they are singleton types (string / maybe int as well?), and then generating a DU over them.
Issue created from Glutinum Tool
Glutinum version - 0.11.0-preview
TypeScript
FSharp
Problem description
The pattern in typescript of using a union of object types that share a singleton typed discriminator field ends up generating an fsharp type with the union of all fields, including duplicates. This could either be detected by finding the intersection of fields in the union, then checking if they are the same type and if they are singleton types (string / maybe int as well?), and then generating a DU over them.