diff --git a/packages/types/app/vue.d.ts b/packages/types/app/vue.d.ts index 655a7bf7f42e..596909d05cd1 100644 --- a/packages/types/app/vue.d.ts +++ b/packages/types/app/vue.d.ts @@ -5,8 +5,9 @@ import type Vue from 'vue' import type { MetaInfo } from 'vue-meta' import type { Route } from 'vue-router' -import type { RecordPropsDefinition, PropsDefinition, ComponentOptions } from 'vue/types/options' -import type { CombinedVueInstance, ExtendedVue } from 'vue/types/vue' +import type { RecordPropsDefinition, ComponentOptions } from 'vue/types/options' +import type { ComponentOptionsMixin } from 'vue/types/v3-component-options' +import type { CombinedVueInstance } from 'vue/types/vue' import type { NuxtRuntimeConfig } from '../config/runtime' import type { Context, Middleware, Transition, NuxtApp } from './index' @@ -26,6 +27,9 @@ declare module 'vue/types/options' { Computed = DefaultComputed, PropsDef = PropsDefinition, Props = DefaultProps, + RawBindings = {}, + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin, /* eslint-enable no-unused-vars,@typescript-eslint/no-unused-vars */ AsyncData = DefaultAsyncData > { @@ -60,7 +64,10 @@ type ThisTypedComponentOptionsWithArrayPropsAndAsyncData< Methods, Computed, PropNames extends string, - AsyncData + SetupBindings, + Mixin extends ComponentOptionsMixin, + Extends extends ComponentOptionsMixin, + AsyncData extends DefaultAsyncData = DefaultAsyncData > = object & ComponentOptions< V, @@ -69,15 +76,21 @@ type ThisTypedComponentOptionsWithArrayPropsAndAsyncData< Computed, PropNames[], Record, - DataDef + Merged>>, + Mixin, + Extends, + AsyncData > & ThisType< CombinedVueInstance< V, - Merged>, + Merged>>, Methods, Computed, - Readonly> + Readonly>, + SetupBindings, + Mixin, + Extends > > export type ThisTypedComponentOptionsWithRecordPropsAndAsyncData< @@ -86,7 +99,10 @@ export type ThisTypedComponentOptionsWithRecordPropsAndAsyncData< Methods, Computed, Props, - AsyncData + SetupBindings, + Mixin extends ComponentOptionsMixin, + Extends extends ComponentOptionsMixin, + AsyncData extends DefaultAsyncData > = object & ComponentOptions< V, @@ -95,12 +111,25 @@ export type ThisTypedComponentOptionsWithRecordPropsAndAsyncData< Computed, RecordPropsDefinition, Props, - DataDef -> & + Merged>>, + Mixin, + Extends, + AsyncData + > & ThisType< - CombinedVueInstance>, Methods, Computed, Readonly> + CombinedVueInstance< + V, + Merged>>, + Methods, + Computed, + Readonly, + SetupBindings, + Mixin, + Extends + > > + declare module 'vue/types/vue' { interface Vue { $config: NuxtRuntimeConfig @@ -113,25 +142,70 @@ declare module 'vue/types/vue' { } } interface VueConstructor { - extend( + /** extend with array props */ + extend< + Data, + Methods, + Computed, + PropNames extends string = never, + SetupBindings = {}, + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin, + AsyncData extends DefaultAsyncData = DefaultAsyncData + >( options?: ThisTypedComponentOptionsWithArrayPropsAndAsyncData< V, Data, Methods, Computed, PropNames, + SetupBindings, + Mixin, + Extends, AsyncData > - ): ExtendedVue> - extend( + ): ExtendedVue< + V, + Data, + Methods, + Computed, + Record, + Merged>>, + Mixin, + Extends + > + + /** extend with object props */ + extend< + Data, + Methods, + Computed, + Props, + SetupBindings = {}, + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin, + AsyncData extends DefaultAsyncData = DefaultAsyncData + >( options?: ThisTypedComponentOptionsWithRecordPropsAndAsyncData< V, Data, Methods, Computed, Props, + SetupBindings, + Mixin, + Extends, AsyncData > - ): ExtendedVue + ): ExtendedVue< + V, + Data, + Methods, + Computed, + Props, + Merged>>, + Mixin, + Extends + > } }