diff --git a/packages/runtime-core/src/apiDefineComponent.ts b/packages/runtime-core/src/apiDefineComponent.ts index 13608f00fad..61766fd1141 100644 --- a/packages/runtime-core/src/apiDefineComponent.ts +++ b/packages/runtime-core/src/apiDefineComponent.ts @@ -33,8 +33,8 @@ import type { SlotsType } from './componentSlots' export type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps - -type ResolveProps = Readonly< +// fixed by xxxxxx +export type ResolveProps = Readonly< PropsOrPropOptions extends ComponentPropsOptions ? ExtractPropTypes : PropsOrPropOptions diff --git a/packages/runtime-core/src/apiWatch.ts b/packages/runtime-core/src/apiWatch.ts index bc10547824e..18e350c2334 100644 --- a/packages/runtime-core/src/apiWatch.ts +++ b/packages/runtime-core/src/apiWatch.ts @@ -64,8 +64,8 @@ type MapSources = { : T[K] : never } - -type OnCleanup = (cleanupFn: () => void) => void +// fixed by xxxxxx +export type OnCleanup = (cleanupFn: () => void) => void export interface WatchOptionsBase extends DebuggerOptions { flush?: 'pre' | 'post' | 'sync' diff --git a/packages/runtime-core/src/index.ts b/packages/runtime-core/src/index.ts index 3a0b702fcd8..e232509a7aa 100644 --- a/packages/runtime-core/src/index.ts +++ b/packages/runtime-core/src/index.ts @@ -423,7 +423,7 @@ export const DeprecationTypes = ( ) as typeof _DeprecationTypes // fixed by xxxxxx -export { defineComponent as defineMixin } from './apiDefineComponent' +export type { OnCleanup } from './apiWatch' import type { CreateAppFunction } from './apiCreateApp' export let createApp: CreateAppFunction export let createSSRApp: CreateAppFunction @@ -463,3 +463,160 @@ export declare function useModel( name: string, options?: any, ): ModelRef + +import type { ObjectDirective } from './directives' +export declare const vShow: ObjectDirective + +import type { + ComponentInjectOptions, + ComponentOptionsMixin, + ComponentOptionsWithArrayProps, + ComponentOptionsWithObjectProps, + ComponentOptionsWithoutProps, + ComputedOptions, + MethodOptions, +} from './componentOptions' +import type { EmitsOptions } from './componentEmits' +import type { SlotsType } from './componentSlots' +import type { + DefineComponent, + PublicProps, + ResolveProps, +} from './apiDefineComponent' +import type { + ComponentPropsOptions, + ExtractDefaultPropTypes, +} from './componentProps' + +export declare function defineMixin< + Props = {}, + RawBindings = {}, + D = {}, + C extends ComputedOptions = {}, + M extends MethodOptions = {}, + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin, + E extends EmitsOptions = {}, + EE extends string = string, + S extends SlotsType = {}, + I extends ComponentInjectOptions = {}, + II extends string = string, +>( + options: ComponentOptionsWithoutProps< + Props, + RawBindings, + D, + C, + M, + Mixin, + Extends, + E, + EE, + I, + II, + S + >, +): DefineComponent< + Props, + RawBindings, + D, + C, + M, + Mixin, + Extends, + E, + EE, + PublicProps, + ResolveProps, + ExtractDefaultPropTypes, + {} +> +export declare function defineMixin< + PropNames extends string, + RawBindings, + D = {}, + C extends ComputedOptions = {}, + M extends MethodOptions = {}, + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin, + E extends EmitsOptions = {}, + EE extends string = string, + S extends SlotsType = {}, + I extends ComponentInjectOptions = {}, + II extends string = string, + Props = Readonly<{ + [key in PropNames]?: any + }>, +>( + options: ComponentOptionsWithArrayProps< + PropNames, + RawBindings, + D, + C, + M, + Mixin, + Extends, + E, + EE, + I, + II, + S + >, +): DefineComponent< + Props, + RawBindings, + D, + C, + M, + Mixin, + Extends, + E, + EE, + PublicProps, + ResolveProps, + ExtractDefaultPropTypes, + {} +> +export declare function defineMixin< + PropsOptions extends Readonly, + RawBindings, + D = {}, + C extends ComputedOptions = {}, + M extends MethodOptions = {}, + Mixin extends ComponentOptionsMixin = ComponentOptionsMixin, + Extends extends ComponentOptionsMixin = ComponentOptionsMixin, + E extends EmitsOptions = {}, + EE extends string = string, + S extends SlotsType = {}, + I extends ComponentInjectOptions = {}, + II extends string = string, +>( + options: ComponentOptionsWithObjectProps< + PropsOptions, + RawBindings, + D, + C, + M, + Mixin, + Extends, + E, + EE, + I, + II, + S + >, +): DefineComponent< + PropsOptions, + RawBindings, + D, + C, + M, + Mixin, + Extends, + E, + EE, + PublicProps, + ResolveProps, + ExtractDefaultPropTypes, + {} +>