-
Notifications
You must be signed in to change notification settings - Fork 668
/
Copy pathindex.d.ts
63 lines (51 loc) · 2.19 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import Vue, { VNodeData, ComponentOptions, FunctionalComponentOptions } from 'vue'
// TODO: use core repo's Component type after https://github.com/vuejs/vue/pull/7369 is released
export type Component =
| typeof Vue
| FunctionalComponentOptions<{}>
| ComponentOptions<never, {}, {}, {}, {}>
/**
* Utility type to declare an extended Vue constructor
*/
type VueClass<V extends Vue> = (new (...args: any[]) => V) & typeof Vue
/**
* Utility type for stubs which can be a string of template as a shorthand
* If it is an array of string, the specified children are replaced by blank components
*/
type Stubs = {
[key: string]: Component | string | true
} | string[]
/**
* Utility type for slots
*/
type Slots = {
[key: string]: (Component | string)[] | Component | string
}
interface MountOptions<V extends Vue> extends ComponentOptions<V> {
attachToDocument?: boolean
context?: VNodeData
localVue?: typeof Vue
mocks?: object
slots?: Slots
scopedSlots?: Record<string, string>
stubs?: Stubs,
attrs?: Record<string, string>
listeners?: Record<string, Function | Function[]>
}
type ThisTypedMountOptions<V extends Vue> = MountOptions<V> & ThisType<V>
type ShallowOptions<V extends Vue> = MountOptions<V>
type ThisTypedShallowOptions<V extends Vue> = ShallowOptions<V> & ThisType<V>
interface VueTestUtilsConfigOptions {
stubs?: Stubs
mocks?: object
methods?: Record<string, Function>
provide?: object,
silent?: Boolean
}
export declare let config: VueTestUtilsConfigOptions
export declare function render<V extends Vue> (component: VueClass<V>, options?: ThisTypedMountOptions<V>): Cheerio
export declare function render<V extends Vue> (component: ComponentOptions<V>, options?: ThisTypedMountOptions<V>): Cheerio
export declare function render (component: FunctionalComponentOptions, options?: MountOptions<Vue>): Cheerio
export declare function renderToString<V extends Vue> (component: VueClass<V>, options?: ThisTypedMountOptions<V>): string
export declare function renderToString<V extends Vue> (component: ComponentOptions<V>, options?: ThisTypedMountOptions<V>): string
export declare function renderToString (component: FunctionalComponentOptions, options?: MountOptions<Vue>): string