Skip to content

Commit

Permalink
fix: added augmented types for PageMeta
Browse files Browse the repository at this point in the history
  • Loading branch information
manchenkoff committed Aug 30, 2024
1 parent 8f8955b commit e784f88
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions src/templates.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { addTypeTemplate, type Resolver } from '@nuxt/kit';
import { addTypeTemplate, type Resolver } from '@nuxt/kit'

export const registerTypeTemplates = (resolver: Resolver) => {
addTypeTemplate({
filename: 'types/sanctum.d.ts',
getContents: () => `// Generated by nuxt-auth-sanctum module
addTypeTemplate({
filename: 'types/sanctum.d.ts',
getContents: () => `// Generated by nuxt-auth-sanctum module
import type { SanctumAppConfig } from '${resolver.resolve('./runtime/types/config.ts')}';
import type { SanctumGlobalMiddlewarePageMeta } from '${resolver.resolve('./runtime/types/meta.ts')}';
Expand Down Expand Up @@ -33,7 +33,16 @@ declare module '#app' {
sanctum?: Partial<SanctumGlobalMiddlewarePageMeta>;
}
}
declare module '#app/../pages/runtime/composables' {
interface PageMeta {
/**
* Sanctum global middleware page configuration.
*/
sanctum?: Partial<SanctumGlobalMiddlewarePageMeta>;
}
}
export {};`,
});
};
})
}

0 comments on commit e784f88

Please sign in to comment.