mirror of
https://github.com/vuejs/vue.git
synced 2024-11-21 20:28:54 +00:00
fix(types): avoid circular type inference between v2 and v3 instance types
fix #12683
This commit is contained in:
parent
ce6fc149e3
commit
fabc1cf89f
2
types/v3-component-public-instance.d.ts
vendored
2
types/v3-component-public-instance.d.ts
vendored
@ -179,9 +179,7 @@ interface Vue3Instance<
|
||||
? Partial<Defaults> & Omit<P & PublicProps, keyof Defaults>
|
||||
: P & PublicProps
|
||||
>,
|
||||
ComponentPublicInstance | null,
|
||||
ComponentPublicInstance,
|
||||
ComponentPublicInstance[],
|
||||
Options & MergedComponentOptionsOverride,
|
||||
EmitFn<E>
|
||||
> {}
|
||||
|
15
types/vue.d.ts
vendored
15
types/vue.d.ts
vendored
@ -14,7 +14,6 @@ import { VNode, VNodeData, VNodeChildren, NormalizedScopedSlot } from './vnode'
|
||||
import { PluginFunction, PluginObject } from './plugin'
|
||||
import { DefineComponent } from './v3-define-component'
|
||||
import { nextTick } from './v3-generated'
|
||||
import { ComponentPublicInstance } from './v3-component-public-instance'
|
||||
|
||||
export interface CreateElement {
|
||||
(
|
||||
@ -41,18 +40,16 @@ type NeverFallback<T, D> = [T] extends [never] ? D : T
|
||||
export interface Vue<
|
||||
Data = Record<string, any>,
|
||||
Props = Record<string, any>,
|
||||
Parent = never,
|
||||
Root = never,
|
||||
Children = never,
|
||||
Instance = never,
|
||||
Options = never,
|
||||
Emit = (event: string, ...args: any[]) => Vue
|
||||
> {
|
||||
// properties with different types in defineComponent()
|
||||
readonly $data: Data
|
||||
readonly $props: Props
|
||||
readonly $parent: NeverFallback<Parent, Vue>
|
||||
readonly $root: NeverFallback<Root, Vue>
|
||||
readonly $children: NeverFallback<Children, Vue[]>
|
||||
readonly $parent: NeverFallback<Instance, Vue> | null
|
||||
readonly $root: NeverFallback<Instance, Vue>
|
||||
readonly $children: NeverFallback<Instance, Vue>[]
|
||||
readonly $options: NeverFallback<Options, ComponentOptions<Vue>>
|
||||
$emit: Emit
|
||||
|
||||
@ -60,10 +57,10 @@ export interface Vue<
|
||||
readonly $el: Element
|
||||
readonly $refs: {
|
||||
[key: string]:
|
||||
| NeverFallback<Instance, Vue>
|
||||
| Vue
|
||||
| Element
|
||||
| ComponentPublicInstance
|
||||
| (Vue | Element | ComponentPublicInstance)[]
|
||||
| (NeverFallback<Instance, Vue> | Vue | Element)[]
|
||||
| undefined
|
||||
}
|
||||
readonly $slots: { [key: string]: VNode[] | undefined }
|
||||
|
Loading…
Reference in New Issue
Block a user