@@ -24,55 +24,63 @@ declare namespace WechatMiniprogram.Behavior {
2424 type RealBehaviorType <
2525 TData extends DataOption = { } ,
2626 TProperty extends PropertyOption = { } ,
27- TMethod extends MethodOption = { }
27+ TMethod extends MethodOption = { } ,
28+ TBehavior extends BehaviorOption = [ ]
2829 > = {
2930 [ key in 'BehaviorType' ] ?: {
30- data : TData
31- properties : TProperty
32- methods : TMethod
31+ data : TData & Component . MixinData < TBehavior >
32+ properties : TProperty & Component . MixinProperties < TBehavior , true >
33+ methods : TMethod & Component . MixinMethods < TBehavior >
3334 }
3435 }
36+
3537 type BehaviorIdentifier = string
3638 type Instance <
3739 TData extends DataOption ,
3840 TProperty extends PropertyOption ,
3941 TMethod extends MethodOption ,
42+ TBehavior extends BehaviorOption ,
4043 TCustomInstanceProperty extends IAnyObject = Record < string , never >
41- > = Component . Instance < TData , TProperty , TMethod , [ ] , TCustomInstanceProperty >
42- type TrivialInstance = Instance < IAnyObject , IAnyObject , IAnyObject >
43- type TrivialOption = Options < IAnyObject , IAnyObject , IAnyObject >
44+ > = Component . Instance < TData , TProperty , TMethod , TBehavior , TCustomInstanceProperty >
45+ type TrivialInstance = Instance < IAnyObject , IAnyObject , IAnyObject , Component . IAnyArray >
46+ type TrivialOption = Options < IAnyObject , IAnyObject , IAnyObject , Component . IAnyArray >
4447 type Options <
4548 TData extends DataOption ,
4649 TProperty extends PropertyOption ,
4750 TMethod extends MethodOption ,
51+ TBehavior extends BehaviorOption ,
4852 TCustomInstanceProperty extends IAnyObject = Record < string , never >
4953 > = Partial < Data < TData > > &
5054 Partial < Property < TProperty > > &
5155 Partial < Method < TMethod > > &
56+ Partial < Behavior < TBehavior > > &
5257 Partial < OtherOption > &
5358 Partial < Lifetimes > &
54- ThisType < Instance < TData , TProperty , TMethod , TCustomInstanceProperty > >
59+ ThisType < Instance < TData , TProperty , TMethod , TBehavior , TCustomInstanceProperty > >
5560 interface Constructor {
5661 <
5762 TData extends DataOption ,
5863 TProperty extends PropertyOption ,
5964 TMethod extends MethodOption ,
65+ TBehavior extends BehaviorOption ,
6066 TCustomInstanceProperty extends IAnyObject = Record < string , never >
6167 > (
62- options : Options < TData , TProperty , TMethod , TCustomInstanceProperty >
63- ) : BehaviorIdentifier & RealBehaviorType < TData , TProperty , TMethod >
68+ options : Options < TData , TProperty , TMethod , TBehavior , TCustomInstanceProperty >
69+ ) : BehaviorIdentifier & RealBehaviorType < TData , TProperty , TMethod , TBehavior >
6470 }
6571
6672 type DataOption = Component . DataOption
6773 type PropertyOption = Component . PropertyOption
6874 type MethodOption = Component . MethodOption
75+ type BehaviorOption = Component . BehaviorOption
6976 type Data < D extends DataOption > = Component . Data < D >
7077 type Property < P extends PropertyOption > = Component . Property < P >
7178 type Method < M extends MethodOption > = Component . Method < M >
79+ type Behavior < B extends BehaviorOption > = Component . Behavior < B >
7280
7381 type DefinitionFilter = Component . DefinitionFilter
7482 type Lifetimes = Component . Lifetimes
75- type OtherOption = Omit < Component . OtherOption , 'options' > & { behaviors : BehaviorIdentifier [ ] }
83+ type OtherOption = Omit < Component . OtherOption , 'options' >
7684}
7785/** 注册一个 `behavior`,接受一个 `Object` 类型的参数。*/
7886declare let Behavior : WechatMiniprogram . Behavior . Constructor
0 commit comments