Effect CommunityEC
Effect Community2y ago
3 replies
anglinb

Using String Enums in TypeScript Without Literal Values

Is there an easy way to use String enums? I don't like being forced to have to use the Typescript enum when setting the literal value
ts 
enum Env { "PRODUCTION", "DEVELOPMENT" }
const EnvSchema = S.Enums(Env)

type TEnv = typeof EnvSchema.Type
const a: TEnv = 'PRODUCTION' // This doesn't work 
Was this page helpful?