Update documentation on 'Middleware types' #11759
Replies: 4 comments 11 replies
-
Hi! We don't explain
And I think each page introducing a feature where But maybe a section in the Typescript guide could make sense since this is a question that comes back regularly (on Discord as well). |
Beta Was this translation helpful? Give feedback.
-
So, if we have all the right pieces in place, would it be helpful if we updated this code block here on the TypeScript page: To add another code comment line, depending on what's actually correct, like:
|
Beta Was this translation helpful? Give feedback.
-
So after talking about this on Talking and Doc'ing, a few solutions were proposed, one of which was this comment by Fryuni. The other solution was to have two to three sentences about this weirdness in regards to ambient types, mentioning how top-level import / export statements break them and linking to the Ambient Modules section in TypeScript's reference documentation. We could then reference this part of Astro docs whenever the issue gets brought up in Support. |
Beta Was this translation helpful? Give feedback.
-
I'm still not sure what is the best solution here. I just wanted to share that we had another PR trying to add Perhaps we should try Louis solution first (since the |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi,
I was working with middleware and locals for the first time and I tried to follow the documentation for it right here. I understood that it is possible to configure types for the locals variable but I couldn't figure it out with the docs. The TS config page does talk about
src/env.d.ts
but doesn't precisely explain how the file must be structured for it to work.My suggestion is to update the documentation to explain
/// <reference types="astro/client" />
ordeclare global {...
in more detail, escpecially for beginners like me :).If it is already explained somewhere else, I would highly appreciate sharing that page's link with me.
Greetings,
Dominic Brauer
Beta Was this translation helpful? Give feedback.
All reactions