You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
You can add optional types to your session data by creating a `src/env.d.ts` file in your project that extends the global `App.SessionData` interface. For example:
8
+
9
+
```ts
10
+
declarenamespaceApp {
11
+
interfaceSessionData {
12
+
user: {
13
+
id:string;
14
+
email:string;
15
+
};
16
+
lastLogin:Date;
17
+
}
18
+
}
19
+
```
20
+
21
+
Any keys not defined in this interface will be treated as `any`.
22
+
23
+
Then when you access `Astro.session` in your components, any defined keys will be typed correctly:
0 commit comments