Skip to content

🚀 Feature Request: wrangler types generates wider types for environment variables #5082

@mw10013

Description

@mw10013

Describe the solution

wrangler types seems to generate literals for environment variables in wrangler.toml. A wider type like string may be more helpful.

[vars]
ENVIRONMENT = "development"

generates

interface Env {
  ENVIRONMENT: "development";
}

Typescript then complains when I try to compare ENVIRONMENT against, say, 'production'.

Screenshot 2024-02-23 at 3 22 04 PM

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions