@proem/union
TypeScript icon, indicating that this package has built-in type declarations

0.0.23 • Public • Published

@proem/union

@proem/union provides functions for processing union types

Usage

import union from '@proem/union'

type Label = 'a' | 'b'

const label: Label = 'a'

function labelToNumber(label: Label) {
  return union.mapLiteral(label, {
    a: () => 1,
    b: () => 2,
  })
}

Package Sidebar

Install

npm i @proem/union

Weekly Downloads

1

Version

0.0.23

License

MIT

Unpacked Size

10.5 kB

Total Files

10

Last publish

Collaborators

  • murtsi