Software Alternatives & Reviews

Building React Components Using Unions in TypeScript

F# Elm
  1. 1

    F#

    F# is a mature, open source, cross-platform, functional-first programming language.
    Pricing:
    • Open Source
    Naturally I’d recommend using a better language such as ReScript or Elm or PureScript or F#‘s Fable + Elmish, but “React” is the king right now and people perceive TypeScript as “less risky” for jobs/hiring, so here we are.

    #Programming Language #OOP #Generic Programming Language 19 social mentions

  2. 2

    Elm

    A type inferred, functional reactive language that compiles to HTML, CSS, and JavaScript
    Pricing:
    • Open Source
    I get it. However, the whole point of using Unions to narrow your types, ensure only a set of possible scenarios can occur, and only access data of a particular union when it’s safe to do so. That’s some of what pattern matching can provide, and 100% of what using switch statements in TypeScript with their Discriminated Unions can provide. Yes, it’s not 100% exhaustive, but TypeScript is not soundly typed, and even Elm which is still has the same issue TypeScript does: You’re running in JavaScript where anything is possible. So it’s good enough to build with and much better than what you had.

    #Programming Language #OOP #Generic Programming Language 114 social mentions

Discuss: Building React Components Using Unions in TypeScript

Log in or Post with