@@ -21,47 +21,64 @@ SOFTWARE.
2121***************************************************************************** */
2222
2323declare namespace WechatMiniprogram . Behavior {
24- type BehaviorIdentifier = string
24+
25+ type BehaviorIdentifier <
26+ TData extends DataOption = { } ,
27+ TProperty extends PropertyOption = { } ,
28+ TMethod extends MethodOption = { } ,
29+ TBehavior extends BehaviorOption = [ ]
30+ > = string & {
31+ [ key in 'BehaviorType' ] ?: {
32+ data : TData & Component . MixinData < TBehavior >
33+ properties : TProperty & Component . MixinProperties < TBehavior , true >
34+ methods : TMethod & Component . MixinMethods < TBehavior >
35+ }
36+ }
2537 type Instance <
2638 TData extends DataOption ,
2739 TProperty extends PropertyOption ,
2840 TMethod extends MethodOption ,
41+ TBehavior extends BehaviorOption ,
2942 TCustomInstanceProperty extends IAnyObject = Record < string , never >
30- > = Component . Instance < TData , TProperty , TMethod , TCustomInstanceProperty >
31- type TrivialInstance = Instance < IAnyObject , IAnyObject , IAnyObject >
32- type TrivialOption = Options < IAnyObject , IAnyObject , IAnyObject >
43+ > = Component . Instance < TData , TProperty , TMethod , TBehavior , TCustomInstanceProperty >
44+ type TrivialInstance = Instance < IAnyObject , IAnyObject , IAnyObject , Component . IEmptyArray >
45+ type TrivialOption = Options < IAnyObject , IAnyObject , IAnyObject , Component . IEmptyArray >
3346 type Options <
3447 TData extends DataOption ,
3548 TProperty extends PropertyOption ,
3649 TMethod extends MethodOption ,
50+ TBehavior extends BehaviorOption ,
3751 TCustomInstanceProperty extends IAnyObject = Record < string , never >
3852 > = Partial < Data < TData > > &
3953 Partial < Property < TProperty > > &
4054 Partial < Method < TMethod > > &
55+ Partial < Behavior < TBehavior > > &
4156 Partial < OtherOption > &
4257 Partial < Lifetimes > &
43- ThisType < Instance < TData , TProperty , TMethod , TCustomInstanceProperty > >
58+ ThisType < Instance < TData , TProperty , TMethod , TBehavior , TCustomInstanceProperty > >
4459 interface Constructor {
4560 <
4661 TData extends DataOption ,
4762 TProperty extends PropertyOption ,
4863 TMethod extends MethodOption ,
64+ TBehavior extends BehaviorOption ,
4965 TCustomInstanceProperty extends IAnyObject = Record < string , never >
5066 > (
51- options : Options < TData , TProperty , TMethod , TCustomInstanceProperty >
52- ) : BehaviorIdentifier
67+ options : Options < TData , TProperty , TMethod , TBehavior , TCustomInstanceProperty >
68+ ) : BehaviorIdentifier < TData , TProperty , TMethod , TBehavior >
5369 }
5470
5571 type DataOption = Component . DataOption
5672 type PropertyOption = Component . PropertyOption
5773 type MethodOption = Component . MethodOption
74+ type BehaviorOption = Component . BehaviorOption
5875 type Data < D extends DataOption > = Component . Data < D >
5976 type Property < P extends PropertyOption > = Component . Property < P >
6077 type Method < M extends MethodOption > = Component . Method < M >
78+ type Behavior < B extends BehaviorOption > = Component . Behavior < B >
6179
6280 type DefinitionFilter = Component . DefinitionFilter
6381 type Lifetimes = Component . Lifetimes
64-
6582 type OtherOption = Omit < Component . OtherOption , 'options' >
6683}
6784/** 注册一个 `behavior`,接受一个 `Object` 类型的参数。*/
0 commit comments