1 | import { AllowedComponentProps } from 'vue';
|
2 | import { ComponentCustomProps } from 'vue';
|
3 | import { ComponentOptions } from 'vue';
|
4 | import { ComponentPublicInstance } from 'vue';
|
5 | import { EmitsOptions } from 'vue';
|
6 | import { Prop } from 'vue';
|
7 | import { PropType } from 'vue';
|
8 | import { Ref } from 'vue';
|
9 | import { ShallowUnwrapRef } from 'vue';
|
10 | import { VNode } from 'vue';
|
11 | import { VNodeProps } from 'vue';
|
12 |
|
13 | export declare interface ClassComponentHooks {
|
14 | data?(): object;
|
15 | beforeCreate?(): void;
|
16 | created?(): void;
|
17 | beforeMount?(): void;
|
18 | mounted?(): void;
|
19 | beforeUnmount?(): void;
|
20 | unmounted?(): void;
|
21 | beforeUpdate?(): void;
|
22 | updated?(): void;
|
23 | activated?(): void;
|
24 | deactivated?(): void;
|
25 | render?(): VNode | void;
|
26 | errorCaptured?(err: Error, vm: Vue, info: string): boolean | undefined;
|
27 | serverPrefetch?(): Promise<unknown>;
|
28 | }
|
29 |
|
30 | export declare function createDecorator(factory: (options: ComponentOptions, key: string, index: number) => void): VueDecorator;
|
31 |
|
32 | export declare type DefaultFactory<T> = (props: Record<string, unknown>) => T | null | undefined;
|
33 |
|
34 | export declare type DefaultKeys<P> = {
|
35 | [K in keyof P]: P[K] extends WithDefault<any> ? K : never;
|
36 | }[keyof P];
|
37 |
|
38 | export declare type ExtractDefaultProps<P> = {
|
39 | [K in DefaultKeys<P>]: P[K] extends WithDefault<infer T> ? T : never;
|
40 | };
|
41 |
|
42 | export declare type ExtractInstance<T> = T extends VueMixin<infer V> ? V : never;
|
43 |
|
44 | export declare type ExtractProps<P> = {
|
45 | [K in keyof P]: P[K] extends WithDefault<infer T> ? T : P[K];
|
46 | };
|
47 |
|
48 | export declare type MixedVueBase<Mixins extends VueMixin[]> = Mixins extends (infer T)[] ? VueConstructor<UnionToIntersection<ExtractInstance<T>> & Vue> : never;
|
49 |
|
50 | export declare function mixins<T extends VueMixin[]>(...Ctors: T): MixedVueBase<T>;
|
51 |
|
52 | export declare function Options<V extends Vue>(options: ComponentOptions & ThisType<V>): <VC extends VueConstructor<VueBase>>(target: VC) => VC;
|
53 |
|
54 | export declare function prop<T>(options: PropOptionsWithDefault<T>): WithDefault<T>;
|
55 |
|
56 | export declare function prop<T>(options: PropOptionsWithRequired<T>): T;
|
57 |
|
58 | export declare function prop<T>(options: Prop<T>): T | undefined;
|
59 |
|
60 | export declare interface PropOptions<T = any, D = T> {
|
61 | type?: PropType<T> | true | null;
|
62 | required?: boolean;
|
63 | default?: D | DefaultFactory<D> | null | undefined | object;
|
64 | validator?(value: unknown): boolean;
|
65 | }
|
66 |
|
67 | export declare interface PropOptionsWithDefault<T, D = T> extends PropOptions<T, D> {
|
68 | default: PropOptions<T, D>['default'];
|
69 | }
|
70 |
|
71 | export declare interface PropOptionsWithRequired<T, D = T> extends PropOptions<T, D> {
|
72 | required: true;
|
73 | }
|
74 |
|
75 | export declare type PublicProps = VNodeProps & AllowedComponentProps & ComponentCustomProps;
|
76 |
|
77 | export declare function setup<R>(setupFn: () => R): UnwrapSetupValue<UnwrapPromise<R>>;
|
78 |
|
79 | export declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
80 |
|
81 | export declare type UnwrapPromise<T> = T extends Promise<infer R> ? R : T;
|
82 |
|
83 | export declare type UnwrapSetupValue<T> = T extends Ref<infer R> ? R : ShallowUnwrapRef<T>;
|
84 |
|
85 | export declare type Vue<Props = unknown, Emits extends EmitsOptions = {}, DefaultProps = {}> = ComponentPublicInstance<Props, {}, {}, {}, {}, Emits, PublicProps, DefaultProps, true> & ClassComponentHooks;
|
86 |
|
87 | export declare const Vue: VueConstructor;
|
88 |
|
89 | export declare type VueBase = Vue<unknown, never[]>;
|
90 |
|
91 | export declare interface VueConstructor<V extends VueBase = Vue> extends VueMixin<V> {
|
92 | new (...args: any[]): V;
|
93 | registerHooks(keys: string[]): void;
|
94 | props<P extends {
|
95 | new (): unknown;
|
96 | }>(Props: P): VueConstructor<V & VueWithProps<InstanceType<P>>>;
|
97 | }
|
98 |
|
99 | export declare interface VueDecorator {
|
100 | (Ctor: VueConstructor<VueBase>): void;
|
101 | (target: VueBase, key: string): void;
|
102 | (target: VueBase, key: string, index: number): void;
|
103 | }
|
104 |
|
105 | export declare type VueMixin<V extends VueBase = VueBase> = VueStatic & {
|
106 | prototype: V;
|
107 | };
|
108 |
|
109 | export declare interface VueStatic {
|
110 |
|
111 |
|
112 |
|
113 |
|
114 |
|
115 |
|
116 |
|
117 |
|
118 |
|
119 |
|
120 |
|
121 |
|
122 | }
|
123 |
|
124 | export declare type VueWithProps<P> = Vue<ExtractProps<P>, {}, ExtractDefaultProps<P>> & ExtractProps<P>;
|
125 |
|
126 | export declare interface WithDefault<T> {
|
127 | [withDefaultSymbol]: T;
|
128 | }
|
129 |
|
130 | declare const withDefaultSymbol: unique symbol;
|
131 |
|
132 | export { }
|