From 30b3eae07263141dc93f8e750486cf0ea7963baa Mon Sep 17 00:00:00 2001 From: gulewei Date: Thu, 11 Aug 2022 16:47:26 +0800 Subject: [PATCH 1/6] feat(types): new Vue() improvements (#12730) --- types/options.d.ts | 28 ++++-- types/test/vue-test.ts | 14 +++ types/v3-component-public-instance.d.ts | 4 +- types/vue.d.ts | 120 +++++++++++++++++++----- 4 files changed, 135 insertions(+), 31 deletions(-) diff --git a/types/options.d.ts b/types/options.d.ts index e11020f4948..ca619bf5323 100644 --- a/types/options.d.ts +++ b/types/options.d.ts @@ -93,7 +93,9 @@ export type ThisTypedComponentOptionsWithArrayProps< Methods, Computed, PropNames extends string, - SetupBindings + SetupBindings, + Mixin, + Extends > = object & ComponentOptions< V, @@ -103,15 +105,19 @@ export type ThisTypedComponentOptionsWithArrayProps< PropNames[], Record, SetupBindings - > & - ThisType< + > & { + mixin?: Mixin[] + extends?: Extends + } & ThisType< CombinedVueInstance< V, Data, Methods, Computed, Readonly>, - SetupBindings + SetupBindings, + Mixin, + Extends > > @@ -124,7 +130,9 @@ export type ThisTypedComponentOptionsWithRecordProps< Methods, Computed, Props, - SetupBindings + SetupBindings, + Mixin, + Extends > = object & ComponentOptions< V, @@ -134,15 +142,19 @@ export type ThisTypedComponentOptionsWithRecordProps< RecordPropsDefinition, Props, SetupBindings - > & - ThisType< + > & { + mixin?: Mixin[] + extends?: Extends + } & ThisType< CombinedVueInstance< V, Data, Methods, Computed, Readonly, - SetupBindings + SetupBindings, + Mixin, + Extends > > diff --git a/types/test/vue-test.ts b/types/test/vue-test.ts index 8489f3ae8ed..253d667b461 100644 --- a/types/test/vue-test.ts +++ b/types/test/vue-test.ts @@ -246,3 +246,17 @@ const ComponentWithStyleInVNodeData = Vue.extend({ ]) } }) + +// infer mixin type with new Vue() #12730 +new Vue({ + mixin: [ + { + methods: { + hello() {} + } + } + ], + created() { + this.hello() + } +}) diff --git a/types/v3-component-public-instance.d.ts b/types/v3-component-public-instance.d.ts index 3586f4031e8..1c55908ac73 100644 --- a/types/v3-component-public-instance.d.ts +++ b/types/v3-component-public-instance.d.ts @@ -79,11 +79,11 @@ type ExtractMixin = { Mixin: MixinToOptionTypes }[T extends ComponentOptionsMixin ? 'Mixin' : never] -type IntersectionMixin = IsDefaultMixinComponent extends true +export type IntersectionMixin = IsDefaultMixinComponent extends true ? OptionTypesType<{}, {}, {}, {}, {}, {}> : UnionToIntersection> -type UnwrapMixinsType< +export type UnwrapMixinsType< T, Type extends OptionTypesKeys > = T extends OptionTypesType ? T[Type] : never diff --git a/types/vue.d.ts b/types/vue.d.ts index 8c91bc88a2f..3c2ccb35798 100644 --- a/types/vue.d.ts +++ b/types/vue.d.ts @@ -14,6 +14,10 @@ import { VNode, VNodeData, VNodeChildren, NormalizedScopedSlot } from './vnode' import { PluginFunction, PluginObject } from './plugin' import { DefineComponent } from './v3-define-component' import { nextTick } from './v3-generated' +import { + UnwrapMixinsType, + IntersectionMixin +} from './v3-component-public-instance' export interface CreateElement { ( @@ -94,18 +98,28 @@ export interface Vue< $createElement: CreateElement } +type ComponentMixin = ComponentOptions + export type CombinedVueInstance< Instance extends Vue, Data, Methods, Computed, Props, - SetupBindings = {} -> = Data & + SetupBindings = {}, + Mixin extends ComponentMixin = ComponentMixin, + Extends extends ComponentMixin = ComponentMixin, + PublicMixin = IntersectionMixin & IntersectionMixin +> = UnwrapMixinsType & + Data & + UnwrapMixinsType & Methods & + UnwrapMixinsType & Computed & + UnwrapMixinsType & Props & Instance & + UnwrapMixinsType & (SetupBindings extends void ? {} : SetupBindings) export type ExtendedVue< @@ -114,9 +128,20 @@ export type ExtendedVue< Methods, Computed, Props, - SetupBindings = {} + SetupBindings = {}, + Mixin extends ComponentMixin = ComponentMixin, + Extends extends ComponentMixin = ComponentMixin > = VueConstructor< - CombinedVueInstance & + CombinedVueInstance< + Instance, + Data, + Methods, + Computed, + Props, + SetupBindings, + Mixin, + Extends + > & Vue > @@ -142,7 +167,9 @@ export interface VueConstructor { Methods = object, Computed = object, PropNames extends string = never, - SetupBindings = {} + SetupBindings = {}, + Mixin extends ComponentMixin = ComponentMixin, + Extends extends ComponentMixin = ComponentMixin >( options?: ThisTypedComponentOptionsWithArrayProps< V, @@ -150,7 +177,9 @@ export interface VueConstructor { Methods, Computed, PropNames, - SetupBindings + SetupBindings, + Mixin, + Extends > ): CombinedVueInstance< V, @@ -158,7 +187,9 @@ export interface VueConstructor { Methods, Computed, Record, - SetupBindings + SetupBindings, + Mixin, + Extends > /** @@ -172,7 +203,9 @@ export interface VueConstructor { Methods = object, Computed = object, Props = object, - SetupBindings = {} + SetupBindings = {}, + Mixin extends ComponentMixin = ComponentMixin, + Extends extends ComponentMixin = ComponentMixin >( options?: ThisTypedComponentOptionsWithRecordProps< V, @@ -180,7 +213,9 @@ export interface VueConstructor { Methods, Computed, Props, - SetupBindings + SetupBindings, + Mixin, + Extends > ): CombinedVueInstance< V, @@ -188,7 +223,9 @@ export interface VueConstructor { Methods, Computed, Record, - SetupBindings + SetupBindings, + Mixin, + Extends > /** @@ -211,7 +248,9 @@ export interface VueConstructor { Methods, Computed, PropNames extends string = never, - SetupBindings = {} + SetupBindings = {}, + Mixin extends ComponentMixin = ComponentMixin, + Extends extends ComponentMixin = ComponentMixin >( options?: ThisTypedComponentOptionsWithArrayProps< V, @@ -219,7 +258,9 @@ export interface VueConstructor { Methods, Computed, PropNames, - SetupBindings + SetupBindings, + Mixin, + Extends > ): ExtendedVue< V, @@ -227,22 +268,43 @@ export interface VueConstructor { Methods, Computed, Record, - SetupBindings + SetupBindings, + Mixin, + Extends > /** * extend with object props */ - extend( + extend< + Data, + Methods, + Computed, + Props, + SetupBindings = {}, + Mixin extends ComponentMixin = ComponentMixin, + Extends extends ComponentMixin = ComponentMixin + >( options?: ThisTypedComponentOptionsWithRecordProps< V, Data, Methods, Computed, Props, - SetupBindings + SetupBindings, + Mixin, + Extends > - ): ExtendedVue + ): ExtendedVue< + V, + Data, + Methods, + Computed, + Props, + SetupBindings, + Mixin, + Extends + > /** * extend with functional + array props @@ -287,7 +349,9 @@ export interface VueConstructor { Methods, Computed, PropNames extends string = never, - SetupBindings = {} + SetupBindings = {}, + Mixin extends ComponentMixin = ComponentMixin, + Extends extends ComponentMixin = ComponentMixin >( id: string, definition?: ThisTypedComponentOptionsWithArrayProps< @@ -296,7 +360,9 @@ export interface VueConstructor { Methods, Computed, PropNames, - SetupBindings + SetupBindings, + Mixin, + Extends > ): ExtendedVue< V, @@ -304,9 +370,19 @@ export interface VueConstructor { Methods, Computed, Record, - SetupBindings + SetupBindings, + Mixin, + Extends > - component( + component< + Data, + Methods, + Computed, + Props, + SetupBindings, + Mixin extends ComponentMixin = ComponentMixin, + Extends extends ComponentMixin = ComponentMixin + >( id: string, definition?: ThisTypedComponentOptionsWithRecordProps< V, @@ -314,7 +390,9 @@ export interface VueConstructor { Methods, Computed, Props, - SetupBindings + SetupBindings, + Mixin, + Extends > ): ExtendedVue component( From 90ee3623f32f52d5815b41166a94682be4472b2d Mon Sep 17 00:00:00 2001 From: Evan You Date: Mon, 15 Aug 2022 09:27:31 +0800 Subject: [PATCH 2/6] fix: mixin -> mixins --- types/options.d.ts | 4 ++-- types/test/vue-test.ts | 13 ++++++++++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/types/options.d.ts b/types/options.d.ts index ca619bf5323..36f58f6a8c2 100644 --- a/types/options.d.ts +++ b/types/options.d.ts @@ -106,7 +106,7 @@ export type ThisTypedComponentOptionsWithArrayProps< Record, SetupBindings > & { - mixin?: Mixin[] + mixins?: Mixin[] extends?: Extends } & ThisType< CombinedVueInstance< @@ -143,7 +143,7 @@ export type ThisTypedComponentOptionsWithRecordProps< Props, SetupBindings > & { - mixin?: Mixin[] + mixins?: Mixin[] extends?: Extends } & ThisType< CombinedVueInstance< diff --git a/types/test/vue-test.ts b/types/test/vue-test.ts index 253d667b461..e804885fcd4 100644 --- a/types/test/vue-test.ts +++ b/types/test/vue-test.ts @@ -249,14 +249,21 @@ const ComponentWithStyleInVNodeData = Vue.extend({ // infer mixin type with new Vue() #12730 new Vue({ - mixin: [ + mixins: [ + { + data() { + return { + foo: 123 + } + } + }, { methods: { - hello() {} + hello(n: number) {} } } ], created() { - this.hello() + this.hello(this.foo) } }) From 4b95a2991d7f31c0ed561595f8130f41cea15a56 Mon Sep 17 00:00:00 2001 From: gulewei Date: Tue, 16 Aug 2022 00:21:53 +0800 Subject: [PATCH 3/6] fix: fix mixin infer --- types/options.d.ts | 8 ++++---- types/vue.d.ts | 12 +++++++++++- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/types/options.d.ts b/types/options.d.ts index 36f58f6a8c2..e291aed9acc 100644 --- a/types/options.d.ts +++ b/types/options.d.ts @@ -106,8 +106,8 @@ export type ThisTypedComponentOptionsWithArrayProps< Record, SetupBindings > & { - mixins?: Mixin[] - extends?: Extends + mixins?: (Mixin | typeof Vue)[] + extends?: Extends | typeof Vue } & ThisType< CombinedVueInstance< V, @@ -143,8 +143,8 @@ export type ThisTypedComponentOptionsWithRecordProps< Props, SetupBindings > & { - mixins?: Mixin[] - extends?: Extends + mixins?: (Mixin | typeof Vue)[] + extends?: Extends | typeof Vue } & ThisType< CombinedVueInstance< V, diff --git a/types/vue.d.ts b/types/vue.d.ts index 3c2ccb35798..8dea7b65ea9 100644 --- a/types/vue.d.ts +++ b/types/vue.d.ts @@ -100,6 +100,14 @@ export interface Vue< type ComponentMixin = ComponentOptions +// IntersectionMixin cannot infer `data` from ComponentOptions<...> +type PrepareMixinData['data']> = { + [K in keyof M]: K extends 'data' + ? D extends (...args: any) => infer R + ? (this: any) => R + : (this: any) => D + : M[K] +} export type CombinedVueInstance< Instance extends Vue, Data, @@ -109,7 +117,9 @@ export type CombinedVueInstance< SetupBindings = {}, Mixin extends ComponentMixin = ComponentMixin, Extends extends ComponentMixin = ComponentMixin, - PublicMixin = IntersectionMixin & IntersectionMixin + PublicMixin = IntersectionMixin> & + IntersectionMixin & + IntersectionMixin> // prevent produce `never` in UnwrapMixinsType > = UnwrapMixinsType & Data & UnwrapMixinsType & From a84af8f5ade4bc01682848b988581a014027d43a Mon Sep 17 00:00:00 2001 From: gulewei Date: Tue, 16 Aug 2022 03:41:23 +0800 Subject: [PATCH 4/6] fix: infer V2 data from mixins --- types/test/vue-test.ts | 6 +++++ types/v3-component-public-instance.d.ts | 31 ++++++++++++++++++++++++- types/vue.d.ts | 13 +++-------- 3 files changed, 39 insertions(+), 11 deletions(-) diff --git a/types/test/vue-test.ts b/types/test/vue-test.ts index e804885fcd4..d0f4785f037 100644 --- a/types/test/vue-test.ts +++ b/types/test/vue-test.ts @@ -255,6 +255,11 @@ new Vue({ return { foo: 123 } + }, + computed: { + bar() { + return 123 + } } }, { @@ -265,5 +270,6 @@ new Vue({ ], created() { this.hello(this.foo) + this.hello(this.bar) } }) diff --git a/types/v3-component-public-instance.d.ts b/types/v3-component-public-instance.d.ts index 1c55908ac73..781496825af 100644 --- a/types/v3-component-public-instance.d.ts +++ b/types/v3-component-public-instance.d.ts @@ -3,7 +3,7 @@ import { ShallowUnwrapRef, UnwrapNestedRefs } from './v3-generated' -import { UnionToIntersection } from './common' +import { IfAny, UnionToIntersection } from './common' import { Vue, VueConstructor } from './vue' import { @@ -57,6 +57,12 @@ type IsDefaultMixinComponent = T extends ComponentOptionsMixin : false : false +type inferData = T extends { data?: infer D } + ? D extends (this: Vue) => infer R + ? IfAny + : IfAny + : {} + type MixinToOptionTypes = T extends ComponentOptionsBase< infer P, infer B, @@ -72,6 +78,29 @@ type MixinToOptionTypes = T extends ComponentOptionsBase< ? OptionTypesType

& IntersectionMixin & IntersectionMixin + : // V3 data not assignable to V2 data + Omit extends ComponentOptionsBase< + infer P, + infer B, + any, + infer C, + infer M, + infer Mixin, + infer Extends, + any, + any, + infer Defaults + > + ? OptionTypesType< + P & {}, + B & {}, + inferData & {}, + C & {}, + M & {}, + Defaults & {} + > & + IntersectionMixin & + IntersectionMixin : never // ExtractMixin(map type) is used to resolve circularly references diff --git a/types/vue.d.ts b/types/vue.d.ts index 8dea7b65ea9..18d75320b82 100644 --- a/types/vue.d.ts +++ b/types/vue.d.ts @@ -18,6 +18,7 @@ import { UnwrapMixinsType, IntersectionMixin } from './v3-component-public-instance' +import { ExtractComputedReturns } from './v3-component-options' export interface CreateElement { ( @@ -100,14 +101,6 @@ export interface Vue< type ComponentMixin = ComponentOptions -// IntersectionMixin cannot infer `data` from ComponentOptions<...> -type PrepareMixinData['data']> = { - [K in keyof M]: K extends 'data' - ? D extends (...args: any) => infer R - ? (this: any) => R - : (this: any) => D - : M[K] -} export type CombinedVueInstance< Instance extends Vue, Data, @@ -117,14 +110,14 @@ export type CombinedVueInstance< SetupBindings = {}, Mixin extends ComponentMixin = ComponentMixin, Extends extends ComponentMixin = ComponentMixin, - PublicMixin = IntersectionMixin> & + PublicMixin = IntersectionMixin & IntersectionMixin & IntersectionMixin> // prevent produce `never` in UnwrapMixinsType > = UnwrapMixinsType & Data & UnwrapMixinsType & Methods & - UnwrapMixinsType & + ExtractComputedReturns> & Computed & UnwrapMixinsType & Props & From 1008c8e77011c7b40b26700fab0d7b3c9de820bc Mon Sep 17 00:00:00 2001 From: gulewei Date: Tue, 16 Aug 2022 19:02:39 +0800 Subject: [PATCH 5/6] feat: support mixins with defineComponent --- types/options.d.ts | 29 ++++++++------- types/test/vue-test.ts | 16 ++++++-- types/v3-component-public-instance.d.ts | 29 --------------- types/vue.d.ts | 49 ++++++++++++------------- 4 files changed, 53 insertions(+), 70 deletions(-) diff --git a/types/options.d.ts b/types/options.d.ts index e291aed9acc..c82c6c5f8ae 100644 --- a/types/options.d.ts +++ b/types/options.d.ts @@ -3,6 +3,7 @@ import { VNode, VNodeData, VNodeDirective, NormalizedScopedSlot } from './vnode' import { SetupContext } from './v3-setup-context' import { DebuggerEvent } from './v3-generated' import { DefineComponent } from './v3-define-component' +import { ComponentOptionsMixin } from './v3-component-options' type Constructor = { new (...args: any[]): any @@ -104,11 +105,11 @@ export type ThisTypedComponentOptionsWithArrayProps< Computed, PropNames[], Record, - SetupBindings - > & { - mixins?: (Mixin | typeof Vue)[] - extends?: Extends | typeof Vue - } & ThisType< + SetupBindings, + Mixin, + Extends + > & + ThisType< CombinedVueInstance< V, Data, @@ -141,11 +142,11 @@ export type ThisTypedComponentOptionsWithRecordProps< Computed, RecordPropsDefinition, Props, - SetupBindings - > & { - mixins?: (Mixin | typeof Vue)[] - extends?: Extends | typeof Vue - } & ThisType< + SetupBindings, + Mixin, + Extends + > & + ThisType< CombinedVueInstance< V, Data, @@ -170,7 +171,9 @@ export interface ComponentOptions< Computed = DefaultComputed, PropsDef = PropsDefinition, Props = DefaultProps, - RawBindings = {} + RawBindings = {}, + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin > { data?: Data props?: PropsDef @@ -229,12 +232,12 @@ export interface ComponentOptions< } parent?: Vue - mixins?: (ComponentOptions | typeof Vue)[] + mixins?: (Mixin | ComponentOptions | typeof Vue)[] name?: string // for SFC auto name inference w/ ts-loader check __name?: string // TODO: support properly inferred 'extends' - extends?: ComponentOptions | typeof Vue + extends?: Extends | ComponentOptions | typeof Vue delimiters?: [string, string] comments?: boolean inheritAttrs?: boolean diff --git a/types/test/vue-test.ts b/types/test/vue-test.ts index d0f4785f037..b792cec583d 100644 --- a/types/test/vue-test.ts +++ b/types/test/vue-test.ts @@ -1,4 +1,4 @@ -import Vue, { VNode } from '../index' +import Vue, { VNode, defineComponent } from '../index' import { ComponentOptions } from '../options' class Test extends Vue { @@ -250,7 +250,14 @@ const ComponentWithStyleInVNodeData = Vue.extend({ // infer mixin type with new Vue() #12730 new Vue({ mixins: [ - { + defineComponent({ + props: { + p1: String, + p2: { + type: Number, + default: 0 + } + }, data() { return { foo: 123 @@ -261,7 +268,7 @@ new Vue({ return 123 } } - }, + }), { methods: { hello(n: number) {} @@ -271,5 +278,8 @@ new Vue({ created() { this.hello(this.foo) this.hello(this.bar) + // @ts-expect-error + this.hello(this.p1) + this.hello(this.p2) } }) diff --git a/types/v3-component-public-instance.d.ts b/types/v3-component-public-instance.d.ts index 781496825af..cd2ed391782 100644 --- a/types/v3-component-public-instance.d.ts +++ b/types/v3-component-public-instance.d.ts @@ -57,12 +57,6 @@ type IsDefaultMixinComponent = T extends ComponentOptionsMixin : false : false -type inferData = T extends { data?: infer D } - ? D extends (this: Vue) => infer R - ? IfAny - : IfAny - : {} - type MixinToOptionTypes = T extends ComponentOptionsBase< infer P, infer B, @@ -78,29 +72,6 @@ type MixinToOptionTypes = T extends ComponentOptionsBase< ? OptionTypesType

& IntersectionMixin & IntersectionMixin - : // V3 data not assignable to V2 data - Omit extends ComponentOptionsBase< - infer P, - infer B, - any, - infer C, - infer M, - infer Mixin, - infer Extends, - any, - any, - infer Defaults - > - ? OptionTypesType< - P & {}, - B & {}, - inferData & {}, - C & {}, - M & {}, - Defaults & {} - > & - IntersectionMixin & - IntersectionMixin : never // ExtractMixin(map type) is used to resolve circularly references diff --git a/types/vue.d.ts b/types/vue.d.ts index 18d75320b82..5a2027a0179 100644 --- a/types/vue.d.ts +++ b/types/vue.d.ts @@ -13,12 +13,15 @@ import { import { VNode, VNodeData, VNodeChildren, NormalizedScopedSlot } from './vnode' import { PluginFunction, PluginObject } from './plugin' import { DefineComponent } from './v3-define-component' -import { nextTick } from './v3-generated' +import { nextTick, UnwrapNestedRefs, ShallowUnwrapRef } from './v3-generated' import { UnwrapMixinsType, IntersectionMixin } from './v3-component-public-instance' -import { ExtractComputedReturns } from './v3-component-options' +import { + ExtractComputedReturns, + ComponentOptionsMixin +} from './v3-component-options' export interface CreateElement { ( @@ -99,8 +102,6 @@ export interface Vue< $createElement: CreateElement } -type ComponentMixin = ComponentOptions - export type CombinedVueInstance< Instance extends Vue, Data, @@ -108,12 +109,10 @@ export type CombinedVueInstance< Computed, Props, SetupBindings = {}, - Mixin extends ComponentMixin = ComponentMixin, - Extends extends ComponentMixin = ComponentMixin, - PublicMixin = IntersectionMixin & - IntersectionMixin & - IntersectionMixin> // prevent produce `never` in UnwrapMixinsType -> = UnwrapMixinsType & + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin, + PublicMixin = IntersectionMixin & IntersectionMixin +> = UnwrapNestedRefs> & Data & UnwrapMixinsType & Methods & @@ -122,7 +121,7 @@ export type CombinedVueInstance< UnwrapMixinsType & Props & Instance & - UnwrapMixinsType & + ShallowUnwrapRef> & (SetupBindings extends void ? {} : SetupBindings) export type ExtendedVue< @@ -132,8 +131,8 @@ export type ExtendedVue< Computed, Props, SetupBindings = {}, - Mixin extends ComponentMixin = ComponentMixin, - Extends extends ComponentMixin = ComponentMixin + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin > = VueConstructor< CombinedVueInstance< Instance, @@ -171,8 +170,8 @@ export interface VueConstructor { Computed = object, PropNames extends string = never, SetupBindings = {}, - Mixin extends ComponentMixin = ComponentMixin, - Extends extends ComponentMixin = ComponentMixin + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin >( options?: ThisTypedComponentOptionsWithArrayProps< V, @@ -207,8 +206,8 @@ export interface VueConstructor { Computed = object, Props = object, SetupBindings = {}, - Mixin extends ComponentMixin = ComponentMixin, - Extends extends ComponentMixin = ComponentMixin + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin >( options?: ThisTypedComponentOptionsWithRecordProps< V, @@ -252,8 +251,8 @@ export interface VueConstructor { Computed, PropNames extends string = never, SetupBindings = {}, - Mixin extends ComponentMixin = ComponentMixin, - Extends extends ComponentMixin = ComponentMixin + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin >( options?: ThisTypedComponentOptionsWithArrayProps< V, @@ -285,8 +284,8 @@ export interface VueConstructor { Computed, Props, SetupBindings = {}, - Mixin extends ComponentMixin = ComponentMixin, - Extends extends ComponentMixin = ComponentMixin + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin >( options?: ThisTypedComponentOptionsWithRecordProps< V, @@ -353,8 +352,8 @@ export interface VueConstructor { Computed, PropNames extends string = never, SetupBindings = {}, - Mixin extends ComponentMixin = ComponentMixin, - Extends extends ComponentMixin = ComponentMixin + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin >( id: string, definition?: ThisTypedComponentOptionsWithArrayProps< @@ -383,8 +382,8 @@ export interface VueConstructor { Computed, Props, SetupBindings, - Mixin extends ComponentMixin = ComponentMixin, - Extends extends ComponentMixin = ComponentMixin + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin >( id: string, definition?: ThisTypedComponentOptionsWithRecordProps< From b5b290c4c6f091bc58a954d495d8c7b27338370d Mon Sep 17 00:00:00 2001 From: gulewei Date: Tue, 16 Aug 2022 19:07:21 +0800 Subject: [PATCH 6/6] fix: remove unused import --- types/v3-component-public-instance.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/types/v3-component-public-instance.d.ts b/types/v3-component-public-instance.d.ts index cd2ed391782..1c55908ac73 100644 --- a/types/v3-component-public-instance.d.ts +++ b/types/v3-component-public-instance.d.ts @@ -3,7 +3,7 @@ import { ShallowUnwrapRef, UnwrapNestedRefs } from './v3-generated' -import { IfAny, UnionToIntersection } from './common' +import { UnionToIntersection } from './common' import { Vue, VueConstructor } from './vue' import {