Skip to content

Latest commit

 

History

History
23 lines (16 loc) · 504 Bytes

README.md

File metadata and controls

23 lines (16 loc) · 504 Bytes

mkenum: make enum type in javascript

npm version

Install

Install via npm package:

yarn add mkenum

Usage

import makeEnum, {type IEnum} from 'mkenum'
// or
const makeEnum = require('mkenum')

const Env = makeEnum('a', 'b', 'c') // type {a: 'a', b: 'b', c: 'c'}
const a = Env.a // type 'a'
type EnvEnum = IEnum<typeof Env> // type 'a' | 'b' | 'c'