variant
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

Variant Build Status npm NPM

A variant type is like an enum but each case can hold some extra data.

npm i -S variant

Variant aims to bring the experience of variant types to TypeScript. Variant types, a.k.a. discriminated unions in the TypeScript world, are an excellent tool for describing and handling flexible domain models and tiny DSLs. However, because "TypeScript instead builds on JavaScript patterns as they exist today" using them as-is can result in tedious and fragile code. This project addresses that by providing well-typed, fluent, and expressive tools to safely do away with the boilerplate.

Variant Logo Documentation

everything below this line is project documentation for developers. Please use the website linked just above.


Initial setup

npm install

build

npm run build

test

npm test

Questions, comments, and contributions are welcome. Open an issue.

Dependencies (0)

    Dev Dependencies (6)

    Package Sidebar

    Install

    npm i variant

    Weekly Downloads

    274

    Version

    2.1.0

    License

    MPL-2.0

    Unpacked Size

    145 kB

    Total Files

    59

    Last publish

    Collaborators

    • paarth