refactor: use TemplateDefaultOptions as default type in NuxtTemplate

This commit is contained in:
Andrey Yolkin 2023-09-03 23:58:46 +03:00
parent 7940c456b6
commit f264b57067
No known key found for this signature in database
GPG Key ID: 4A2899263001EA49

View File

@ -18,7 +18,11 @@ export interface NuxtPlugin {
order?: number order?: number
} }
export interface NuxtTemplate<Options = Record<string, any>> { // Internal type for simpler NuxtTemplate interface extension
type TemplateDefaultOptions = Record<string, any>
export interface NuxtTemplate<Options = TemplateDefaultOptions> {
/** resolved output file path (generated) */ /** resolved output file path (generated) */
dst?: string dst?: string
/** The target filename once the template is copied into the Nuxt buildDir */ /** The target filename once the template is copied into the Nuxt buildDir */
@ -33,17 +37,17 @@ export interface NuxtTemplate<Options = Record<string, any>> {
write?: boolean write?: boolean
} }
export interface ResolvedNuxtTemplate<Options = Record<string, any>> extends NuxtTemplate<Options> { export interface ResolvedNuxtTemplate<Options = TemplateDefaultOptions> extends NuxtTemplate<Options> {
filename: string filename: string
dst: string dst: string
} }
export interface NuxtTypeTemplate<Options = Record<string, any>> extends Omit<NuxtTemplate<Options>, 'write'> { export interface NuxtTypeTemplate<Options = TemplateDefaultOptions> extends Omit<NuxtTemplate<Options>, 'write'> {
write?: true write?: true
} }
type _TemplatePlugin<Options> = Omit<NuxtPlugin, 'src'> & NuxtTemplate<Options> type _TemplatePlugin<Options> = Omit<NuxtPlugin, 'src'> & NuxtTemplate<Options>
export interface NuxtPluginTemplate<Options = Record<string, any>> extends _TemplatePlugin<Options> { } export interface NuxtPluginTemplate<Options = TemplateDefaultOptions> extends _TemplatePlugin<Options> { }
export interface NuxtApp { export interface NuxtApp {
mainComponent?: string | null mainComponent?: string | null