Skip to content

Convert a string to an enum type with TypeScript ⚡️

Notifications You must be signed in to change notification settings

Qeepsake/ts-string-as-enum

Repository files navigation

Convert String to Enum with TypeScript

Tiny (zero dependencies) utility to Convert string to enum type with TypeScript ⚡️

Install

npm install --save @qeepsake/ts-string-as-enum

Usage

export declare enum Colors {
    /** JSDoc */
    Blue = "Blue",
    /** JSDoc */
    Red = "Red",
    /** JSDoc */
    Green = "Green",
}

tsStringAsEnum(Colors, 'blue'); // -> Colors.Blue

License

MIT © lukebrandonfarrell

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Luke Brandon Farrell

📆 💻

This project follows the all-contributors specification. Contributions of any kind welcome!

About

Convert a string to an enum type with TypeScript ⚡️

Resources

Stars

Watchers

Forks

Packages

No packages published