项目作者: paarthenon

项目描述 :
Variant types in TypeScript
高级语言: TypeScript
项目地址: git://github.com/paarthenon/variant.git
创建时间: 2019-09-25T00:58:38Z
项目社区:https://github.com/paarthenon/variant

开源协议:Mozilla Public License 2.0

下载


Variant Build Status npm NPM

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

  1. 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

✨ Variant 3.0 is in active development. Documentation featuring 3.0 features will be available shortly. In the meantime, the changes are available here.

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


Initial setup

  1. npm install

build

  1. npm run build

test

  1. npm test

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