Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Type definition change source when build android

I'm building a app on react-native with Expo. I created a .env file with my variables. The problemas is that when I run npx expo run:android the process.env type definition change and the only available var is NODE_ENV, so I get the error Property 'EXPO_PUBLIC_ANDROID_FIREBASE_CLIENT_ID' does not exist on type 'typeof env'., as you can see in the image the type definition if from android folder:

enter image description here

When I delete the android folder the type definition return to nomrally and every process.env.MY_VAR_ENV is defined as string | undefined

I tried creating a process-env.d.ts file but when I added to tscongi.json other import are borken, the file are utils or type definitions with Zod (also i tried adding the folder in tsconfig.json without success.

enter image description here

I tried creating a process-env.d.ts file but when I added to tscongi.json other import are borken, the file are utils or type definitions with Zod (also i tried adding the folder in tsconfig.json without success.

like image 319
enmanuelmag Avatar asked Mar 17 '26 20:03

enmanuelmag


1 Answers

You can add the exclude key to the tsconfig.json, like this:

"exclude": ["android", "ios"]
like image 177
Tran Hoang Avatar answered Mar 20 '26 13:03

Tran Hoang