Skip to content

bug: vite typescript does not infer the environment variables type. #195

Description

@ixahmedxi

Hello, very nice package i've been fighting with t3-env to work well with arktype and it's very cool to see a first party integration to give us build time env vars errors with arktype.

I'm just wondering, i've added arkenv and the vite plugin to my application, expected that the import.meta.env.SOMETHING would infer the correct type as pointed out in the readme of the example:

// src/App.tsx
function App() {
    return (
        <div>
            <p>API URL: {import.meta.env.VITE_API_URL}</p>
            {/* TypeScript knows the exact type! */}
        </div>
    );
}

however, hovering over the environment variable yields any as the type, also there is no autocomplete available.

I even tested directly with the example in this repo and i can't get import.meta.env to know about the environment variables that i've defined in arkenv vite plugin.

Image

Metadata

Metadata

Assignees

Labels

@arkenv/vite-pluginIssues or Pull Requests involving the Vite plugin for ArkEnvbugSomething isn't workinggood first issueGood for newcomers

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions