Index: app/lib/actions.ts
===================================================================
--- app/lib/actions.ts	(revision 3d391828d902fe0c570f5748c209cad1e30ab60d)
+++ app/lib/actions.ts	(revision 54323a7e8e5026db0c04665efb042a95f414da58)
@@ -108,5 +108,5 @@
 export async function createInvoice(prevState: State, formData: FormData) {
     const session = await requireAuth();
-    const userId = session.user?.id; // userId is now trusted & typed
+    const userId = session.user.id; // userId is now trusted & typed
 
     const validatedFields = CreateInvoice.safeParse({
Index: app/lib/auth-utils.ts
===================================================================
--- app/lib/auth-utils.ts	(revision 3d391828d902fe0c570f5748c209cad1e30ab60d)
+++ app/lib/auth-utils.ts	(revision 54323a7e8e5026db0c04665efb042a95f414da58)
@@ -1,12 +1,21 @@
 import { auth } from '@/auth';
 import { redirect } from 'next/navigation';
+import type { Session } from 'next-auth';
 
-export async function requireAuth() {
+type AuthenticatedSession = Session & {
+    user: {
+        id: string;
+        name: string;
+        email: string;
+    };
+};
+
+export async function requireAuth(): Promise<AuthenticatedSession> {
     const session = await auth();
 
-    if (!session?.user) {
+    if (!session || !session.user) {
         redirect('/login');
     }
 
-    return session;
+    return session as AuthenticatedSession;
 }
