-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update middleware.mdx #10810
base: main
Are you sure you want to change the base?
Update middleware.mdx #10810
Conversation
Updated the env.d.ts section to reflect the current working implementation
✅ Deploy Preview for astro-docs-2 ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify site configuration. |
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
Hello! Thank you for opening your first PR to Astro’s Docs! 🎉 Here’s what will happen next:
|
declare global { | ||
namespace App { | ||
interface Locals { | ||
user: { | ||
name: string | ||
}, | ||
welcomeTitle: () => string, | ||
orders: Map<string, object> | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @ruohki and thanks for taking the time to help making the docs better!
I don't know if you followed the discussion in Discord but I don't think we should use declare global
here because without imports it is working as expected. But I agree, we should show how to use an imported type as it seems to be confusing. Perhaps something like:
declare global { | |
namespace App { | |
interface Locals { | |
user: { | |
name: string | |
}, | |
welcomeTitle: () => string, | |
orders: Map<string, object> | |
} | |
} | |
} | |
namespace App { | |
interface Locals { | |
site: { | |
title: string | |
}, | |
welcomeTitle: () => string, | |
orders: Map<string, object>, | |
user: import("@supabase/supabase-js").User | |
} | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm so maybe we could show both versions and mention that if someone is using imports to use the global approach? Or yeah at least clarify on how to use imported types. I do this regularly, sort of misuse locals as my little singleton accesor
Edit: made change
Description (required)
Updated the env.d.ts section to reflect the current working implementation
discord: ruohki