Skip to content

Type of Erased types #2914

Open
Open

Description

@alfonsogarciacaro

Right now any type decorated with Erase becomes Any in Fable AST. This makes sense because originally Erase was thought for erased unions representing Typescript unions. However now there are cases where we want to erase the declaration but not necessarily the type.

Another use case is when using a union just to wrap a primitive, then it should probably become the type of the primitive (although I'm not sure if Fable users frequently do this).

Activity

  1. dbrattli commented on Aug 27, 2022

    @dbrattli
    Collaborator

    Yes, this would be really nice for Python if it was possible. E.g for the example:

    let fn (a: U2<string, int>) =
        ()

    It's currently translated to:

    def fn(a: Any=None) -> None:
        pass

    I would like to transpile this to become:

    def fn(a: Tuple[str, int]) -> None:
        pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

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