Skip to content

Support instanceof checks for exported Scala class constructors #4062

@swachter

Description

@swachter

At the moment, instanceof checks do only work for classes that extend js.Object. Unfortunately case classes must not extend js.Object.

Motivation (copied from Gitter): I would like to define Scala ADTs (represented by sealed traits plus cases classes) by TypeScript union types. A common pattern for exhaustiveness checks in TypeScript is to use flow typing with instanceof checks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementFeature request (that does not concern language semantics, see "language")

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions