UNPKG

27.9 kBTypeScriptView Raw
1import Vue$1, { VNode, VueConstructor, ComponentOptions, AsyncComponent, VNodeDirective, CreateElement } from 'vue';
2import { Component as Component$1, AsyncComponent as AsyncComponent$1 } from 'vue/types/options';
3import { VNodeChildren, VNode as VNode$1, VNodeData } from 'vue/types/vnode';
4
5declare type Data = {
6 [key: string]: unknown;
7};
8
9declare type ComponentPropsOptions<P = Data> = ComponentObjectPropsOptions<P> | string[];
10declare type ComponentObjectPropsOptions<P = Data> = {
11 [K in keyof P]: Prop<P[K]> | null;
12};
13declare type Prop<T, D = T> = PropOptions<T, D> | PropType<T>;
14declare type DefaultFactory<T> = () => T | null | undefined;
15interface PropOptions<T = any, D = T> {
16 type?: PropType<T> | true | null;
17 required?: boolean;
18 default?: D | DefaultFactory<D> | null | undefined | object;
19 validator?(value: unknown): boolean;
20}
21declare type PropType<T> = PropConstructor<T> | PropConstructor<T>[];
22declare type PropConstructor<T> = {
23 new (...args: any[]): T & object;
24} | {
25 (): T;
26} | {
27 new (...args: string[]): Function;
28};
29declare type RequiredKeys<T> = {
30 [K in keyof T]: T[K] extends {
31 required: true;
32 } | {
33 default: any;
34 } | BooleanConstructor | {
35 type: BooleanConstructor;
36 } ? K : never;
37}[keyof T];
38declare type OptionalKeys<T> = Exclude<keyof T, RequiredKeys<T>>;
39declare type ExtractFunctionPropType<T extends Function, TArgs extends Array<any> = any[], TResult = any> = T extends (...args: TArgs) => TResult ? T : never;
40declare type ExtractCorrectPropType<T> = T extends Function ? ExtractFunctionPropType<T> : Exclude<T, Function>;
41declare type InferPropType<T> = T extends null ? any : T extends {
42 type: null | true;
43} ? any : T extends ObjectConstructor | {
44 type: ObjectConstructor;
45} ? Record<string, any> : T extends BooleanConstructor | {
46 type: BooleanConstructor;
47} ? boolean : T extends DateConstructor | {
48 type: DateConstructor;
49} ? Date : T extends FunctionConstructor | {
50 type: FunctionConstructor;
51} ? Function : T extends Prop<infer V, infer D> ? unknown extends V ? D extends null | undefined ? V : D : ExtractCorrectPropType<V> : T;
52declare type ExtractPropTypes<O> = {
53 [K in keyof Pick<O, RequiredKeys<O>>]: InferPropType<O[K]>;
54} & {
55 [K in keyof Pick<O, OptionalKeys<O>>]?: InferPropType<O[K]>;
56};
57declare type DefaultKeys<T> = {
58 [K in keyof T]: T[K] extends {
59 default: any;
60 } | BooleanConstructor | {
61 type: BooleanConstructor;
62 } ? T[K] extends {
63 type: BooleanConstructor;
64 required: true;
65 } ? never : K : never;
66}[keyof T];
67declare type ExtractDefaultPropTypes<O> = O extends object ? {
68 [K in keyof Pick<O, DefaultKeys<O>>]: InferPropType<O[K]>;
69} : {};
70
71declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
72
73declare type Slot = (...args: any[]) => VNode[];
74declare type InternalSlots = {
75 [name: string]: Slot | undefined;
76};
77declare type ObjectEmitsOptions = Record<string, ((...args: any[]) => any) | null>;
78declare type EmitsOptions = ObjectEmitsOptions | string[];
79declare type EmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options, ReturnType extends void | Vue$1 = void> = Options extends Array<infer V> ? (event: V, ...args: any[]) => ReturnType : {} extends Options ? (event: string, ...args: any[]) => ReturnType : UnionToIntersection<{
80 [key in Event]: Options[key] extends (...args: infer Args) => any ? (event: key, ...args: Args) => ReturnType : (event: key, ...args: any[]) => ReturnType;
81}[Event]>;
82declare type ComponentRenderEmitFn<Options = ObjectEmitsOptions, Event extends keyof Options = keyof Options, T extends Vue$1 | void = void> = EmitFn<Options, Event, T>;
83declare type Slots = Readonly<InternalSlots>;
84interface SetupContext<E extends EmitsOptions = {}> {
85 attrs: Data;
86 slots: Slots;
87 emit: EmitFn<E>;
88 /**
89 * @deprecated not available in Vue 2
90 */
91 expose: (exposed?: Record<string, any>) => void;
92 /**
93 * @deprecated not available in Vue 3
94 */
95 readonly parent: ComponentInstance | null;
96 /**
97 * @deprecated not available in Vue 3
98 */
99 readonly root: ComponentInstance;
100 /**
101 * @deprecated not available in Vue 3
102 */
103 readonly listeners: {
104 [key in string]?: Function;
105 };
106 /**
107 * @deprecated not available in Vue 3
108 */
109 readonly refs: {
110 [key: string]: Vue | Element | Vue[] | Element[];
111 };
112}
113/**
114 * We expose a subset of properties on the internal instance as they are
115 * useful for advanced external libraries and tools.
116 */
117declare interface ComponentInternalInstance {
118 uid: number;
119 type: Record<string, unknown>;
120 parent: ComponentInternalInstance | null;
121 root: ComponentInternalInstance;
122 /**
123 * Vnode representing this component in its parent's vdom tree
124 */
125 vnode: VNode;
126 /**
127 * Root vnode of this component's own vdom tree
128 */
129 /**
130 * The reactive effect for rendering and patching the component. Callable.
131 */
132 update: Function;
133 data: Data;
134 props: Data;
135 attrs: Data;
136 refs: Data;
137 emit: EmitFn;
138 slots: InternalSlots;
139 emitted: Record<string, boolean> | null;
140 proxy: ComponentInstance;
141 isMounted: boolean;
142 isUnmounted: boolean;
143 isDeactivated: boolean;
144}
145declare function getCurrentInstance(): ComponentInternalInstance | null;
146
147declare type EmitsToProps<T extends EmitsOptions> = T extends string[] ? {
148 [K in string & `on${Capitalize<T[number]>}`]?: (...args: any[]) => any;
149} : T extends ObjectEmitsOptions ? {
150 [K in string & `on${Capitalize<string & keyof T>}`]?: K extends `on${infer C}` ? T[Uncapitalize<C>] extends null ? (...args: any[]) => any : (...args: T[Uncapitalize<C>] extends (...args: infer P) => any ? P : never) => any : never;
151} : {};
152declare type ComponentInstance = InstanceType<VueConstructor>;
153declare type ComponentRenderProxy<P = {}, // props type extracted from props option
154B = {}, // raw bindings returned from setup()
155D = {}, // return from data()
156C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false> = {
157 $data: D;
158 $props: Readonly<MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<P & PublicProps, keyof Defaults> : P & PublicProps>;
159 $attrs: Record<string, string>;
160 $emit: ComponentRenderEmitFn<Emits, keyof Emits, ComponentRenderProxy<P, B, D, C, M, Mixin, Extends, Emits, PublicProps, Defaults, MakeDefaultsOptional>>;
161} & Readonly<P> & ShallowUnwrapRef<B> & D & M & ExtractComputedReturns<C> & Omit<Vue$1, '$data' | '$props' | '$attrs' | '$emit'>;
162declare type VueConstructorProxy<PropsOptions, RawBindings, Data, Computed extends ComputedOptions, Methods extends MethodOptions, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}, Props = ExtractPropTypes<PropsOptions> & ({} extends Emits ? {} : EmitsToProps<Emits>)> = Omit<VueConstructor, never> & {
163 new (...args: any[]): ComponentRenderProxy<Props, ShallowUnwrapRef<RawBindings>, Data, Computed, Methods, Mixin, Extends, Emits, Props, ExtractDefaultPropTypes<PropsOptions>, true>;
164};
165declare type DefaultData<V> = object | ((this: V) => object);
166declare type DefaultMethods<V> = {
167 [key: string]: (this: V, ...args: any[]) => any;
168};
169declare type DefaultComputed = {
170 [key: string]: any;
171};
172declare type VueProxy<PropsOptions, RawBindings, Data = DefaultData<Vue$1>, Computed extends ComputedOptions = DefaultComputed, Methods extends MethodOptions = DefaultMethods<Vue$1>, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}> = ComponentOptions<Vue$1, ShallowUnwrapRef<RawBindings> & Data, Methods, Computed, PropsOptions, ExtractPropTypes<PropsOptions>> & VueConstructorProxy<PropsOptions, RawBindings, Data, Computed, Methods, Mixin, Extends, Emits>;
173declare type ComponentPublicInstance<P = {}, // props type extracted from props option
174B = {}, // raw bindings returned from setup()
175D = {}, // return from data()
176C extends ComputedOptions = {}, M extends MethodOptions = {}, E extends EmitsOptions = {}, PublicProps = P, Defaults = {}, MakeDefaultsOptional extends boolean = false> = {
177 $: ComponentInternalInstance;
178 $data: D;
179 $props: MakeDefaultsOptional extends true ? Partial<Defaults> & Omit<P & PublicProps, keyof Defaults> : P & PublicProps;
180 $attrs: Data;
181 $refs: Data;
182 $slots: Slots;
183 $root: ComponentPublicInstance | null;
184 $parent: ComponentPublicInstance | null;
185 $emit: EmitFn<E>;
186 $el: any;
187 $forceUpdate: () => void;
188 $nextTick: typeof nextTick;
189 $watch(source: string | Function, cb: Function, options?: WatchOptions): WatchStopHandle;
190} & P & ShallowUnwrapRef<B> & UnwrapNestedRefs<D> & ExtractComputedReturns<C> & M;
191
192declare type ComputedGetter$1<T> = (ctx?: any) => T;
193declare type ComputedSetter$1<T> = (v: T) => void;
194interface WritableComputedOptions$1<T> {
195 get: ComputedGetter$1<T>;
196 set: ComputedSetter$1<T>;
197}
198declare type ComputedOptions = Record<string, ComputedGetter$1<any> | WritableComputedOptions$1<any>>;
199interface MethodOptions {
200 [key: string]: Function;
201}
202declare type SetupFunction<Props, RawBindings = {}, Emits extends EmitsOptions = {}> = (this: void, props: Readonly<Props>, ctx: SetupContext<Emits>) => RawBindings | (() => VNode | null) | void;
203interface ComponentOptionsBase<Props, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}> extends Omit<ComponentOptions<Vue$1, D, M, C, Props>, 'data' | 'computed' | 'method' | 'setup' | 'props'> {
204 [key: string]: any;
205 data?: (this: Props & Vue$1, vm: Props) => D;
206 computed?: C;
207 methods?: M;
208}
209declare type ExtractComputedReturns<T extends any> = {
210 [key in keyof T]: T[key] extends {
211 get: (...args: any[]) => infer TReturn;
212 } ? TReturn : T[key] extends (...args: any[]) => infer TReturn ? TReturn : never;
213};
214declare type ComponentOptionsWithProps<PropsOptions = ComponentPropsOptions, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}, Props = ExtractPropTypes<PropsOptions>> = ComponentOptionsBase<Props, D, C, M> & {
215 props?: PropsOptions;
216 emits?: Emits & ThisType<void>;
217 setup?: SetupFunction<Props, RawBindings, Emits>;
218} & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M, Mixin, Extends, Emits>>;
219declare type ComponentOptionsWithArrayProps<PropNames extends string = string, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}, Props = Readonly<{
220 [key in PropNames]?: any;
221}>> = ComponentOptionsBase<Props, D, C, M> & {
222 props?: PropNames[];
223 emits?: Emits & ThisType<void>;
224 setup?: SetupFunction<Props, RawBindings, Emits>;
225} & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M, Mixin, Extends, Emits>>;
226declare type ComponentOptionsWithoutProps<Props = {}, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}> = ComponentOptionsBase<Props, D, C, M> & {
227 props?: undefined;
228 emits?: Emits & ThisType<void>;
229 setup?: SetupFunction<Props, RawBindings, Emits>;
230} & ThisType<ComponentRenderProxy<Props, RawBindings, D, C, M, Mixin, Extends, Emits>>;
231
232declare type AnyObject = Record<string | number | symbol, any>;
233declare type Equal<Left, Right> = (<U>() => U extends Left ? 1 : 0) extends (<U>() => U extends Right ? 1 : 0) ? true : false;
234declare type HasDefined<T> = Equal<T, unknown> extends true ? false : true;
235
236/**
237 * overload 1: object format with no props
238 */
239declare function defineComponent<RawBindings, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}>(options: ComponentOptionsWithoutProps<{}, RawBindings, D, C, M, Mixin, Extends, Emits>): VueProxy<{}, RawBindings, D, C, M, Mixin, Extends, Emits>;
240/**
241 * overload 2: object format with array props declaration
242 * props inferred as `{ [key in PropNames]?: any }`
243 *
244 * return type is for Vetur and TSX support
245 */
246declare function defineComponent<PropNames extends string, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}, PropsOptions extends ComponentPropsOptions = ComponentPropsOptions>(options: ComponentOptionsWithArrayProps<PropNames, RawBindings, D, C, M, Mixin, Extends, Emits>): VueProxy<Readonly<{
247 [key in PropNames]?: any;
248}>, RawBindings, D, C, M, Mixin, Extends, Emits>;
249/**
250 * overload 3: object format with object props declaration
251 *
252 * see `ExtractPropTypes` in './componentProps.ts'
253 */
254declare function defineComponent<Props, RawBindings = Data, D = Data, C extends ComputedOptions = {}, M extends MethodOptions = {}, Mixin = {}, Extends = {}, Emits extends EmitsOptions = {}, PropsOptions extends ComponentPropsOptions = ComponentPropsOptions>(options: HasDefined<Props> extends true ? ComponentOptionsWithProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, Emits, Props> : ComponentOptionsWithProps<PropsOptions, RawBindings, D, C, M, Mixin, Extends, Emits>): VueProxy<PropsOptions, RawBindings, D, C, M, Mixin, Extends, Emits>;
255
256declare type Component = VueProxy<any, any, any, any, any>;
257declare type ComponentOrComponentOptions = Component | ComponentOptionsWithoutProps | ComponentOptionsWithArrayProps | ComponentOptionsWithProps;
258declare type AsyncComponentResolveResult<T = ComponentOrComponentOptions> = T | {
259 default: T;
260};
261declare type AsyncComponentLoader = () => Promise<AsyncComponentResolveResult>;
262interface AsyncComponentOptions {
263 loader: AsyncComponentLoader;
264 loadingComponent?: ComponentOrComponentOptions;
265 errorComponent?: ComponentOrComponentOptions;
266 delay?: number;
267 timeout?: number;
268 suspensible?: boolean;
269 onError?: (error: Error, retry: () => void, fail: () => void, attempts: number) => any;
270}
271declare function defineAsyncComponent(source: AsyncComponentLoader | AsyncComponentOptions): AsyncComponent;
272
273declare type DirectiveModifiers = Record<string, boolean>;
274interface DirectiveBinding<V> extends Readonly<VNodeDirective> {
275 readonly modifiers: DirectiveModifiers;
276 readonly value: V;
277 readonly oldValue: V | null;
278}
279declare type DirectiveHook<T = any, Prev = VNode | null, V = any> = (el: T, binding: DirectiveBinding<V>, vnode: VNode, prevVNode: Prev) => void;
280interface ObjectDirective<T = any, V = any> {
281 bind?: DirectiveHook<T, any, V>;
282 inserted?: DirectiveHook<T, any, V>;
283 update?: DirectiveHook<T, any, V>;
284 componentUpdated?: DirectiveHook<T, any, V>;
285 unbind?: DirectiveHook<T, any, V>;
286}
287declare type FunctionDirective<T = any, V = any> = DirectiveHook<T, any, V>;
288declare type Directive<T = any, V = any> = ObjectDirective<T, V> | FunctionDirective<T, V>;
289
290declare const Plugin: {
291 install: (Vue: VueConstructor) => void;
292};
293
294declare const _refBrand: unique symbol;
295interface Ref<T = any> {
296 readonly [_refBrand]: true;
297 value: T;
298}
299interface WritableComputedRef<T> extends Ref<T> {
300 /**
301 * `effect` is added to be able to differentiate refs from computed properties.
302 * **Differently from Vue 3, it's just `true`**. This is because there is no equivalent
303 * of `ReactiveEffect<T>` in `@vue/composition-api`.
304 */
305 effect: true;
306}
307interface ComputedRef<T = any> extends WritableComputedRef<T> {
308 readonly value: T;
309}
310declare type ToRefs<T = any> = {
311 [K in keyof T]: Ref<T[K]>;
312};
313declare type CollectionTypes = IterableCollections | WeakCollections;
314declare type IterableCollections = Map<any, any> | Set<any>;
315declare type WeakCollections = WeakMap<any, any> | WeakSet<any>;
316declare type BaseTypes = string | number | boolean | Node | Window | Date;
317declare type ShallowUnwrapRef<T> = {
318 [K in keyof T]: T[K] extends Ref<infer V> ? V : T[K];
319};
320declare type UnwrapRef<T> = T extends Ref<infer V> ? UnwrapRefSimple<V> : UnwrapRefSimple<T>;
321declare type UnwrapRefSimple<T> = T extends Function | CollectionTypes | BaseTypes | Ref ? T : T extends Array<any> ? {
322 [K in keyof T]: UnwrapRefSimple<T[K]>;
323} : T extends object ? {
324 [P in keyof T]: P extends symbol ? T[P] : UnwrapRef<T[P]>;
325} : T;
326interface RefOption<T> {
327 get(): T;
328 set?(x: T): void;
329}
330declare class RefImpl<T> implements Ref<T> {
331 readonly [_refBrand]: true;
332 value: T;
333 constructor({ get, set }: RefOption<T>);
334}
335declare function createRef<T>(options: RefOption<T>, isReadonly?: boolean, isComputed?: boolean): RefImpl<T>;
336declare function ref<T extends object>(raw: T): T extends Ref ? T : Ref<UnwrapRef<T>>;
337declare function ref<T>(raw: T): Ref<UnwrapRef<T>>;
338declare function ref<T = any>(): Ref<T | undefined>;
339declare function isRef<T>(value: any): value is Ref<T>;
340declare function unref<T>(ref: T | Ref<T>): T;
341declare function toRefs<T extends object>(obj: T): ToRefs<T>;
342declare type CustomRefFactory<T> = (track: () => void, trigger: () => void) => {
343 get: () => T;
344 set: (value: T) => void;
345};
346declare function customRef<T>(factory: CustomRefFactory<T>): Ref<T>;
347declare function toRef<T extends object, K extends keyof T>(object: T, key: K): Ref<T[K]>;
348declare function shallowRef<T extends object>(value: T): T extends Ref ? T : Ref<T>;
349declare function shallowRef<T>(value: T): Ref<T>;
350declare function shallowRef<T = any>(): Ref<T | undefined>;
351declare function triggerRef(value: any): void;
352declare function proxyRefs<T extends object>(objectWithRefs: T): ShallowUnwrapRef<T>;
353
354declare function isRaw(obj: any): boolean;
355declare function isReactive(obj: any): boolean;
356declare function shallowReactive<T extends object = any>(obj: T): T;
357/**
358 * Make obj reactivity
359 */
360declare function reactive<T extends object>(obj: T): UnwrapRef<T>;
361/**
362 * Make sure obj can't be a reactive
363 */
364declare function markRaw<T extends object>(obj: T): T;
365declare function toRaw<T>(observed: T): T;
366
367declare function isReadonly(obj: any): boolean;
368declare type Primitive = string | number | boolean | bigint | symbol | undefined | null;
369declare type Builtin = Primitive | Function | Date | Error | RegExp;
370declare type DeepReadonly<T> = T extends Builtin ? T : T extends Map<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends ReadonlyMap<infer K, infer V> ? ReadonlyMap<DeepReadonly<K>, DeepReadonly<V>> : T extends WeakMap<infer K, infer V> ? WeakMap<DeepReadonly<K>, DeepReadonly<V>> : T extends Set<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends ReadonlySet<infer U> ? ReadonlySet<DeepReadonly<U>> : T extends WeakSet<infer U> ? WeakSet<DeepReadonly<U>> : T extends Promise<infer U> ? Promise<DeepReadonly<U>> : T extends {} ? {
371 readonly [K in keyof T]: DeepReadonly<T[K]>;
372} : Readonly<T>;
373declare type UnwrapNestedRefs<T> = T extends Ref ? T : UnwrapRefSimple<T>;
374/**
375 * **In @vue/composition-api, `reactive` only provides type-level readonly check**
376 *
377 * Creates a readonly copy of the original object. Note the returned copy is not
378 * made reactive, but `readonly` can be called on an already reactive object.
379 */
380declare function readonly<T extends object>(target: T): DeepReadonly<UnwrapNestedRefs<T>>;
381declare function shallowReadonly<T extends object>(obj: T): Readonly<T>;
382
383/**
384 * Set a property on an object. Adds the new property, triggers change
385 * notification and intercept it's subsequent access if the property doesn't
386 * already exist.
387 */
388declare function set<T>(target: AnyObject, key: any, val: T): T;
389
390/**
391 * Delete a property and trigger change if necessary.
392 */
393declare function del(target: AnyObject, key: any): void;
394
395declare const onBeforeMount: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
396declare const onMounted: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
397declare const onBeforeUpdate: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
398declare const onUpdated: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
399declare const onBeforeUnmount: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
400declare const onUnmounted: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
401declare const onErrorCaptured: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
402declare const onActivated: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
403declare const onDeactivated: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
404declare const onServerPrefetch: (callback: Function, target?: ComponentInternalInstance | null | undefined) => Function | null;
405
406declare type WatchEffect = (onInvalidate: InvalidateCbRegistrator) => void;
407declare type WatchSource<T = any> = Ref<T> | ComputedRef<T> | (() => T);
408declare type WatchCallback<V = any, OV = any> = (value: V, oldValue: OV, onInvalidate: InvalidateCbRegistrator) => any;
409declare type MapSources<T, Immediate> = {
410 [K in keyof T]: T[K] extends WatchSource<infer V> ? Immediate extends true ? V | undefined : V : never;
411};
412declare type MultiWatchSources = (WatchSource<unknown> | object)[];
413interface WatchOptionsBase {
414 flush?: FlushMode;
415}
416declare type InvalidateCbRegistrator = (cb: () => void) => void;
417declare type FlushMode = 'pre' | 'post' | 'sync';
418interface WatchOptions<Immediate = boolean> extends WatchOptionsBase {
419 immediate?: Immediate;
420 deep?: boolean;
421}
422interface VueWatcher {
423 lazy: boolean;
424 get(): any;
425 teardown(): void;
426 run(): void;
427 value: any;
428}
429declare type WatchStopHandle = () => void;
430declare function watchEffect(effect: WatchEffect, options?: WatchOptionsBase): WatchStopHandle;
431declare function watchPostEffect(effect: WatchEffect): WatchStopHandle;
432declare function watchSyncEffect(effect: WatchEffect): WatchStopHandle;
433declare function watch<T extends Readonly<MultiWatchSources>, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
434declare function watch<T extends Readonly<MultiWatchSources>, Immediate extends Readonly<boolean> = false>(sources: T, cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
435declare function watch<T extends MultiWatchSources, Immediate extends Readonly<boolean> = false>(sources: [...T], cb: WatchCallback<MapSources<T, false>, MapSources<T, Immediate>>, options?: WatchOptions<Immediate>): WatchStopHandle;
436declare function watch<T, Immediate extends Readonly<boolean> = false>(source: WatchSource<T>, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
437declare function watch<T extends object, Immediate extends Readonly<boolean> = false>(source: T, cb: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: WatchOptions<Immediate>): WatchStopHandle;
438
439declare type ComputedGetter<T> = (ctx?: any) => T;
440declare type ComputedSetter<T> = (v: T) => void;
441interface WritableComputedOptions<T> {
442 get: ComputedGetter<T>;
443 set: ComputedSetter<T>;
444}
445declare function computed<T>(getter: ComputedGetter<T>): ComputedRef<T>;
446declare function computed<T>(options: WritableComputedOptions<T>): WritableComputedRef<T>;
447
448interface InjectionKey<T> extends Symbol {
449}
450declare function provide<T>(key: InjectionKey<T> | string, value: T): void;
451declare function inject<T>(key: InjectionKey<T> | string): T | undefined;
452declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T, treatDefaultAsFactory?: false): T;
453declare function inject<T>(key: InjectionKey<T> | string, defaultValue: T | (() => T), treatDefaultAsFactory?: true): T;
454
455declare const useCssModule: (name?: string) => Record<string, string>;
456/**
457 * @deprecated use `useCssModule` instead.
458 */
459declare const useCSSModule: (name?: string) => Record<string, string>;
460
461interface App<T = any> {
462 config: VueConstructor['config'];
463 use: VueConstructor['use'];
464 mixin: VueConstructor['mixin'];
465 component: VueConstructor['component'];
466 directive(name: string): Directive | undefined;
467 directive(name: string, directive: Directive): this;
468 provide<T>(key: InjectionKey<T> | symbol | string, value: T): this;
469 mount: Vue$1['$mount'];
470 unmount: Vue$1['$destroy'];
471}
472declare function createApp(rootComponent: any, rootProps?: any): App;
473
474declare type NextTick = Vue$1['$nextTick'];
475declare const nextTick: NextTick;
476
477interface H extends CreateElement {
478 (this: ComponentInternalInstance | null | undefined, tag?: string | Component$1<any, any, any, any> | AsyncComponent$1<any, any, any, any> | (() => Component$1), children?: VNodeChildren): VNode$1;
479 (this: ComponentInternalInstance | null | undefined, tag?: string | Component$1<any, any, any, any> | AsyncComponent$1<any, any, any, any> | (() => Component$1), data?: VNodeData, children?: VNodeChildren): VNode$1;
480}
481declare const createElement: H;
482
483/**
484 * Displays a warning message (using console.error) with a stack trace if the
485 * function is called inside of active component.
486 *
487 * @param message warning message to be displayed
488 */
489declare function warn(message: string): void;
490
491declare class EffectScopeImpl {
492 active: boolean;
493 effects: EffectScope[];
494 cleanups: (() => void)[];
495 constructor(vm: Vue);
496 run<T>(fn: () => T): T | undefined;
497 on(): void;
498 off(): void;
499 stop(): void;
500}
501declare class EffectScope extends EffectScopeImpl {
502 constructor(detached?: boolean);
503}
504declare function effectScope(detached?: boolean): EffectScope;
505declare function getCurrentScope(): EffectScope | undefined;
506declare function onScopeDispose(fn: () => void): void;
507
508declare function useSlots(): SetupContext['slots'];
509declare function useAttrs(): SetupContext['attrs'];
510
511declare const version: string;
512
513declare module 'vue/types/options' {
514 interface ComponentOptions<V extends Vue$1> {
515 setup?: SetupFunction<Data, Data>;
516 }
517}
518
519export { App, ComponentInstance, ComponentInternalInstance, ComponentPropsOptions, ComponentPublicInstance, ComponentRenderProxy, ComputedGetter, ComputedOptions, ComputedRef, ComputedSetter, Data, DeepReadonly, Directive, DirectiveBinding, DirectiveHook, DirectiveModifiers, EffectScope, ExtractDefaultPropTypes, ExtractPropTypes, FlushMode, FunctionDirective, InjectionKey, MethodOptions, ObjectDirective, PropOptions, PropType, Ref, SetupContext, SetupFunction, ShallowUnwrapRef, ToRefs, UnwrapNestedRefs, UnwrapRef, UnwrapRefSimple, VueWatcher, WatchCallback, WatchEffect, WatchOptions, WatchOptionsBase, WatchSource, WatchStopHandle, WritableComputedOptions, WritableComputedRef, computed, createApp, createRef, customRef, Plugin as default, defineAsyncComponent, defineComponent, del, effectScope, getCurrentInstance, getCurrentScope, createElement as h, inject, isRaw, isReactive, isReadonly, isRef, markRaw, nextTick, onActivated, onBeforeMount, onBeforeUnmount, onBeforeUpdate, onDeactivated, onErrorCaptured, onMounted, onScopeDispose, onServerPrefetch, onUnmounted, onUpdated, provide, proxyRefs, reactive, readonly, ref, set, shallowReactive, shallowReadonly, shallowRef, toRaw, toRef, toRefs, triggerRef, unref, useAttrs, useCSSModule, useCssModule, useSlots, version, warn, watch, watchEffect, watchPostEffect, watchSyncEffect };
520
\No newline at end of file