#How to get TypeScript IntelliSense for your User Defined Environment Variables in `.env` file

8 messages · Page 1 of 1 (latest)

austere plaza
#

I am trying to achieve TypeScript Intellisense (Auto-Completion) of my environment variables when I make the call import.meta.env. in my code but I only see the default PUBLIC environment variables. @devout furnace

azure elbow
#

Not sure if it makes any difference, but I have this working without the reference types on the top line.

drowsy raptor
#

I was just about to say this. I believe I read in some release that generated types were moved from env.d.ts to .astro/types.d.ts as well. I wonder if this is causing a conflict.

pure anchor
#

Can you try naming the file env.d.ts instead of .env.d.ts? I'm not sure if typescript picks up files starting with a .

austere plaza
#

I see that i misread the documentation. I accidentally added a .

pure anchor
winged patioBOT
#
If your issue is resolved, please help by doing the following two steps:
  1. From the ellipses (3-dot menu) in the top-right corner of the post (not the first message), edit the tags to include the Solved tag.
  2. From the same ellipses, select Close Post.
    Your post will still be available to search and can be re-opened simply by replying in it. Closing a post moves it down with older posts, so we can more easily focus on issues that still need to be resolved.
    Thank you for your help!