-
Notifications
You must be signed in to change notification settings - Fork 113
/
Copy pathcomputed.test.d.ts
48 lines (47 loc) · 1.53 KB
/
computed.test.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
declare namespace WechatMiniprogram {
namespace Component {
type ComputedOption = Record<string, () => any>
interface Computed<C extends ComputedOption> {
computed: C
}
type ComputedOptionToData<C extends ComputedOption> = {
[K in keyof C]: C[K] extends () => infer R ? R : any
}
type ComputedInstance<
D extends DataOption,
P extends PropertyOption,
M extends MethodOption,
C extends ComputedOption,
CustomProperty extends IAnyObject = Record<string, never>,
> = Instance<D, P, M, [], CustomProperty> & { data: ComputedOptionToData<C> }
type ComputedOptions<
D extends DataOption,
P extends PropertyOption,
M extends MethodOption,
C extends ComputedOption,
CustomProperty extends IAnyObject = Record<string, never>,
> = Partial<Computed<C>> &
ThisType<ComputedInstance<D, P, M, C, CustomProperty>> &
Options<D, P, M, []>
interface ComputedConstructor {
<
D extends DataOption,
P extends PropertyOption,
M extends MethodOption,
C extends ComputedOption,
CustomProperty extends IAnyObject = Record<string, never>,
>(
options: ComputedOptions<D, P, M, C, CustomProperty>,
): string
}
}
}
declare type ComputedComponent = WechatMiniprogram.Component.ComputedConstructor
declare type IAnyObject = WechatMiniprogram.IAnyObject
declare type ComputedOptions = WechatMiniprogram.Component.ComputedOptions<
IAnyObject,
IAnyObject,
IAnyObject,
IAnyObject,
IAnyObject
>