types(runtime-core): refactor defineComponent (#1883)

This commit is contained in:
Carlos Rodrigues
2020-09-15 16:46:11 +01:00
committed by GitHub
parent 848ccf56fb
commit 4fd468aced
8 changed files with 583 additions and 132 deletions

View File

@@ -27,8 +27,7 @@ import {
OptionTypesType,
OptionTypesKeys,
resolveMergedOptions,
isInBeforeCreate,
UnwrapAsyncBindings
isInBeforeCreate
} from './componentOptions'
import { EmitsOptions, EmitFn } from './componentEmits'
import { Slots } from './componentSlots'
@@ -102,7 +101,18 @@ type UnwrapMixinsType<
type EnsureNonVoid<T> = T extends void ? {} : T
export type ComponentPublicInstanceConstructor<
T extends ComponentPublicInstance = ComponentPublicInstance<any>
T extends ComponentPublicInstance<
Props,
RawBindings,
D,
C,
M
> = ComponentPublicInstance<any>,
Props = any,
RawBindings = any,
D = any,
C extends ComputedOptions = ComputedOptions,
M extends MethodOptions = MethodOptions
> = {
__isFragment?: never
__isTeleport?: never
@@ -138,6 +148,7 @@ export type CreateComponentPublicInstance<
PublicProps,
ComponentOptionsBase<P, B, D, C, M, Mixin, Extends, E>
>
// public properties exposed on the proxy, which is used as the render context
// in templates (as `this` in the render option)
export type ComponentPublicInstance<
@@ -169,7 +180,7 @@ export type ComponentPublicInstance<
options?: WatchOptions
): WatchStopHandle
} & P &
ShallowUnwrapRef<UnwrapAsyncBindings<B>> &
ShallowUnwrapRef<B> &
D &
ExtractComputedReturns<C> &
M &