Skip to content

Combined and Omit<> types #474

Open
Open
@Wouter8

Description

I'm wondering if combined types (using &) and Omitted fields (using Omit<> ) are supported. I understand that these features are not supported by F#, but I was hoping that this tool had a workaround for it.

I tried it in the online demo and it seems ts2fable simply doesn't even try.

Input:

type Foo = {
    field1: "value1" | "value2";
    field2: number;
}

type Combined = Foo & {
    other: string;
}

type Omitted = Omit<Foo, "value">;

Output:

// ts2fable 0.9.0
module rec moduleName
open System
open Fable.Core
open Fable.Core.JS


type [<AllowNullLiteral>] Foo =
    abstract field1: FooField1 with get, set
    abstract field2: float with get, set

type [<AllowNullLiteral>] Combined =
    interface end

type Omitted =
    Omit<Foo, string>

type [<StringEnum>] [<RequireQualifiedAccess>] FooField1 =
    | Value1
    | Value2

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions