mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-26 23:52:06 +00:00
fix(types): sync vue type augmentations with Vue 2.7 (#19526)
Co-authored-by: Daniel Roe <daniel@roe.dev>
This commit is contained in:
parent
8e0aba0cda
commit
ce1df2f9ae
100
packages/types/app/vue.d.ts
vendored
100
packages/types/app/vue.d.ts
vendored
@ -5,8 +5,9 @@
|
|||||||
import type Vue from 'vue'
|
import type Vue from 'vue'
|
||||||
import type { MetaInfo } from 'vue-meta'
|
import type { MetaInfo } from 'vue-meta'
|
||||||
import type { Route } from 'vue-router'
|
import type { Route } from 'vue-router'
|
||||||
import type { RecordPropsDefinition, PropsDefinition, ComponentOptions } from 'vue/types/options'
|
import type { RecordPropsDefinition, ComponentOptions } from 'vue/types/options'
|
||||||
import type { CombinedVueInstance, ExtendedVue } from 'vue/types/vue'
|
import type { ComponentOptionsMixin } from 'vue/types/v3-component-options'
|
||||||
|
import type { CombinedVueInstance } from 'vue/types/vue'
|
||||||
import type { NuxtRuntimeConfig } from '../config/runtime'
|
import type { NuxtRuntimeConfig } from '../config/runtime'
|
||||||
import type { Context, Middleware, Transition, NuxtApp } from './index'
|
import type { Context, Middleware, Transition, NuxtApp } from './index'
|
||||||
|
|
||||||
@ -26,6 +27,9 @@ declare module 'vue/types/options' {
|
|||||||
Computed = DefaultComputed,
|
Computed = DefaultComputed,
|
||||||
PropsDef = PropsDefinition<DefaultProps>,
|
PropsDef = PropsDefinition<DefaultProps>,
|
||||||
Props = DefaultProps,
|
Props = DefaultProps,
|
||||||
|
RawBindings = {},
|
||||||
|
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
|
||||||
|
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
|
||||||
/* eslint-enable no-unused-vars,@typescript-eslint/no-unused-vars */
|
/* eslint-enable no-unused-vars,@typescript-eslint/no-unused-vars */
|
||||||
AsyncData = DefaultAsyncData<V>
|
AsyncData = DefaultAsyncData<V>
|
||||||
> {
|
> {
|
||||||
@ -60,7 +64,10 @@ type ThisTypedComponentOptionsWithArrayPropsAndAsyncData<
|
|||||||
Methods,
|
Methods,
|
||||||
Computed,
|
Computed,
|
||||||
PropNames extends string,
|
PropNames extends string,
|
||||||
AsyncData
|
SetupBindings,
|
||||||
|
Mixin extends ComponentOptionsMixin,
|
||||||
|
Extends extends ComponentOptionsMixin,
|
||||||
|
AsyncData extends DefaultAsyncData<V> = DefaultAsyncData<V>
|
||||||
> = object &
|
> = object &
|
||||||
ComponentOptions<
|
ComponentOptions<
|
||||||
V,
|
V,
|
||||||
@ -69,15 +76,21 @@ type ThisTypedComponentOptionsWithArrayPropsAndAsyncData<
|
|||||||
Computed,
|
Computed,
|
||||||
PropNames[],
|
PropNames[],
|
||||||
Record<PropNames, any>,
|
Record<PropNames, any>,
|
||||||
DataDef<AsyncData, PropNames, V>
|
Merged<SetupBindings, Awaited<ReturnType<AsyncData>>>,
|
||||||
|
Mixin,
|
||||||
|
Extends,
|
||||||
|
AsyncData
|
||||||
> &
|
> &
|
||||||
ThisType<
|
ThisType<
|
||||||
CombinedVueInstance<
|
CombinedVueInstance<
|
||||||
V,
|
V,
|
||||||
Merged<Data, Awaited<AsyncData>>,
|
Merged<Data, Awaited<ReturnType<AsyncData>>>,
|
||||||
Methods,
|
Methods,
|
||||||
Computed,
|
Computed,
|
||||||
Readonly<Record<PropNames, any>>
|
Readonly<Record<PropNames, any>>,
|
||||||
|
SetupBindings,
|
||||||
|
Mixin,
|
||||||
|
Extends
|
||||||
>
|
>
|
||||||
>
|
>
|
||||||
export type ThisTypedComponentOptionsWithRecordPropsAndAsyncData<
|
export type ThisTypedComponentOptionsWithRecordPropsAndAsyncData<
|
||||||
@ -86,7 +99,10 @@ export type ThisTypedComponentOptionsWithRecordPropsAndAsyncData<
|
|||||||
Methods,
|
Methods,
|
||||||
Computed,
|
Computed,
|
||||||
Props,
|
Props,
|
||||||
AsyncData
|
SetupBindings,
|
||||||
|
Mixin extends ComponentOptionsMixin,
|
||||||
|
Extends extends ComponentOptionsMixin,
|
||||||
|
AsyncData extends DefaultAsyncData<V>
|
||||||
> = object &
|
> = object &
|
||||||
ComponentOptions<
|
ComponentOptions<
|
||||||
V,
|
V,
|
||||||
@ -95,11 +111,24 @@ export type ThisTypedComponentOptionsWithRecordPropsAndAsyncData<
|
|||||||
Computed,
|
Computed,
|
||||||
RecordPropsDefinition<Props>,
|
RecordPropsDefinition<Props>,
|
||||||
Props,
|
Props,
|
||||||
DataDef<AsyncData, Props, V>
|
Merged<SetupBindings, Awaited<ReturnType<AsyncData>>>,
|
||||||
|
Mixin,
|
||||||
|
Extends,
|
||||||
|
AsyncData
|
||||||
> &
|
> &
|
||||||
ThisType<
|
ThisType<
|
||||||
CombinedVueInstance<V, Merged<Data, Awaited<AsyncData>>, Methods, Computed, Readonly<Props>>
|
CombinedVueInstance<
|
||||||
|
V,
|
||||||
|
Merged<Data, Awaited<ReturnType<AsyncData>>>,
|
||||||
|
Methods,
|
||||||
|
Computed,
|
||||||
|
Readonly<Props>,
|
||||||
|
SetupBindings,
|
||||||
|
Mixin,
|
||||||
|
Extends
|
||||||
>
|
>
|
||||||
|
>
|
||||||
|
|
||||||
|
|
||||||
declare module 'vue/types/vue' {
|
declare module 'vue/types/vue' {
|
||||||
interface Vue {
|
interface Vue {
|
||||||
@ -113,25 +142,70 @@ declare module 'vue/types/vue' {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
interface VueConstructor<V extends Vue> {
|
interface VueConstructor<V extends Vue> {
|
||||||
extend<Data, Methods, Computed, PropNames extends string, AsyncData>(
|
/** extend with array props */
|
||||||
|
extend<
|
||||||
|
Data,
|
||||||
|
Methods,
|
||||||
|
Computed,
|
||||||
|
PropNames extends string = never,
|
||||||
|
SetupBindings = {},
|
||||||
|
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
|
||||||
|
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
|
||||||
|
AsyncData extends DefaultAsyncData<V> = DefaultAsyncData<V>
|
||||||
|
>(
|
||||||
options?: ThisTypedComponentOptionsWithArrayPropsAndAsyncData<
|
options?: ThisTypedComponentOptionsWithArrayPropsAndAsyncData<
|
||||||
V,
|
V,
|
||||||
Data,
|
Data,
|
||||||
Methods,
|
Methods,
|
||||||
Computed,
|
Computed,
|
||||||
PropNames,
|
PropNames,
|
||||||
|
SetupBindings,
|
||||||
|
Mixin,
|
||||||
|
Extends,
|
||||||
AsyncData
|
AsyncData
|
||||||
>
|
>
|
||||||
): ExtendedVue<V, Data, Methods, Computed, Record<PropNames, any>>
|
): ExtendedVue<
|
||||||
extend<Data, Methods, Computed, Props, AsyncData>(
|
V,
|
||||||
|
Data,
|
||||||
|
Methods,
|
||||||
|
Computed,
|
||||||
|
Record<PropNames, any>,
|
||||||
|
Merged<SetupBindings, Awaited<ReturnType<AsyncData>>>,
|
||||||
|
Mixin,
|
||||||
|
Extends
|
||||||
|
>
|
||||||
|
|
||||||
|
/** extend with object props */
|
||||||
|
extend<
|
||||||
|
Data,
|
||||||
|
Methods,
|
||||||
|
Computed,
|
||||||
|
Props,
|
||||||
|
SetupBindings = {},
|
||||||
|
Mixin extends ComponentOptionsMixin = ComponentOptionsMixin,
|
||||||
|
Extends extends ComponentOptionsMixin = ComponentOptionsMixin,
|
||||||
|
AsyncData extends DefaultAsyncData<V> = DefaultAsyncData<V>
|
||||||
|
>(
|
||||||
options?: ThisTypedComponentOptionsWithRecordPropsAndAsyncData<
|
options?: ThisTypedComponentOptionsWithRecordPropsAndAsyncData<
|
||||||
V,
|
V,
|
||||||
Data,
|
Data,
|
||||||
Methods,
|
Methods,
|
||||||
Computed,
|
Computed,
|
||||||
Props,
|
Props,
|
||||||
|
SetupBindings,
|
||||||
|
Mixin,
|
||||||
|
Extends,
|
||||||
AsyncData
|
AsyncData
|
||||||
>
|
>
|
||||||
): ExtendedVue<V, Data, Methods, Computed, Props>
|
): ExtendedVue<
|
||||||
|
V,
|
||||||
|
Data,
|
||||||
|
Methods,
|
||||||
|
Computed,
|
||||||
|
Props,
|
||||||
|
Merged<SetupBindings, Awaited<ReturnType<AsyncData>>>,
|
||||||
|
Mixin,
|
||||||
|
Extends
|
||||||
|
>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user