"export" PageMeta overrides from layer

I have an auth layer that has a middleware that checks routse for route.meta.permissions I added that to a .d.ts file so I get full type safety:
declare module "#app" {
interface PageMeta {
permissions?: UserPermission[];
}
}

// It is always important to ensure you import/export something when augmenting a type
export {};
declare module "#app" {
interface PageMeta {
permissions?: UserPermission[];
}
}

// It is always important to ensure you import/export something when augmenting a type
export {};
But, the app i have extending this layer doesn't get that type safety. What can i do to fix that?
2 Replies
kapa.ai
kapa.ai2mo ago
Hi @Bobakanoosh. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- To address your question about exporting PageMeta overrides from a Nuxt layer to the main app, I can provide some insights based on the available knowledge sources. However, the specific scenario you're describing isn't directly covered in the provided documents. The closest relevant information comes from Docs > Guide > Going-further > Authoring Nuxt Layers > Multi-Layer Support for Nuxt Modules. This document explains how to use layers in Nuxt, but it doesn't specifically address type augmentation across layers. For type augmentation in Nuxt, we can refer to Docs > Guide > Concepts > TypeScript. This document mentions that Nuxt auto-generates types, including .nuxt/nuxt.d.ts which contains types from modules you're using. However, it doesn't explicitly cover how to propagate custom type augmentations from a layer to the main app. Given the limitations of the information provided, I can't give you a definitive solution to make your type augmentation work across layers. The knowledge sources don't contain enough information to answer your specific question about exporting PageMeta overrides from a layer to the main app. To get a more accurate and specific answer, you might want to: 1. Check the official Nuxt documentation for any updates on type augmentation in layers. 2. Consider asking this question in the Nuxt community forums or GitHub issues, as it seems to be a specific use case that might require input from the Nuxt core team or experienced community members. I apologize that I couldn't provide a more concrete solution based on the available information. If you have any other questions about Nuxt that might be covered by the provided knowledge sources, feel free to ask. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai2mo ago
<@193115930857832448> Kapa.ai is still learning and improving, please let me know how I did by reacting below.

Did you find this page helpful?