It's my first time using Next.js with TypeScript and I'm wondering if there's a better way to pass .env variables to a TypeScript file.
here's my code at the moment
import { Client, Databases } from 'appwrite';
export const client = new Client();
export const databases = new Databases(client);
client
.setEndpoint(process.env.NEXT_PUBLIC_APPWRITE_ENDPOINT as string)
.setProject(process.env.NEXT_PUBLIC_APPWRITE_PROJECT_ID as string);
as you can see, to fix my ts error, Argument of type 'string | undefined' is not assignable to parameter of type 'string'. Type 'undefined' is not assignable to type 'string'. I have to add as string after my env variable. Just wondering if there is a better way to do this. without installing package?