Effect CommunityEC
Effect Community2y ago
3 replies
Stephen Bluck

Improving `Config.literal` Construction for Specific Literal Types in TypeScript

Is there a better way to construct a Config.literal with a default value?
const mode = Config.withDefault(Config.literal("dev", "live")("APP_MODE"), "dev" as const);

If I remove the as const then mode is of type string when it should be the literal values of "dev" | "live"
Was this page helpful?