How to fix env types on `schema.mjs`?

export const serverSchema = z.object({
NODE_ENV: z.enum(["development", "test", "production"]),
VERCEL_ENV: z.enum(["development", "preview", "production"]),
})

export const serverEnv = {
NODE_ENV: process.env.NODE_ENV,
VERCEL_ENV: process.env.VERCEL_ENV, // <-- TS not happy (see image)
}
export const serverSchema = z.object({
NODE_ENV: z.enum(["development", "test", "production"]),
VERCEL_ENV: z.enum(["development", "preview", "production"]),
})

export const serverEnv = {
NODE_ENV: process.env.NODE_ENV,
VERCEL_ENV: process.env.VERCEL_ENV, // <-- TS not happy (see image)
}
2 Replies
CODY
CODYOP2y ago
omg i realize this question is dumb. I should do process.env.VERCEL_ENV instead. But how to resolve this issue anw.
JacobMGEvans
JacobMGEvans2y ago
I got you.
Want results from more Discord servers?
Add your server