I'm working with a TypeScript project in Astro where I've defined a custom namespace for Astro's App.Locals interface. My declarations look like this:
export interface CustomUser extends User {
role: string;
preferredModuleType: string;
}
declare namespace App {
interface Locals {
flashError: string;
user: CustomUser | null;
session: import("better-auth").Session | null;
}
}
However, I've suddenly lost access to these properties (flashError, user, session) in my code where I previously could access them through locals. TypeScript no longer recognizes these properties as existing on the locals object. I haven't changed the type declarations, so I'm not sure what could be causing this. Has anyone encountered a similar issue with Astro's type system or can suggest what might be breaking my type definitions?