@@ -2,18 +2,34 @@ declare namespace MiniProgram.Mixin {
22 /**
33 * 传统的组件间代码复用,仅Component的mixins参数支持传入,Mixin参数mixins 则只支持传入Mixin()的返回值
44 */
5- type IMixin4Legacy = Partial < Omit < Component . IOptions < UnknownRecord , UnknownRecord , UnknownRecord , UnknownRecord , [ ] > , 'ref' | 'options' | 'mixins' | 'externalClasses' > > ;
5+ type IMixin4Legacy = Partial <
6+ Omit <
7+ Component . IOptions <
8+ UnknownRecord ,
9+ UnknownRecord ,
10+ UnknownRecord ,
11+ UnknownRecord ,
12+ [ ]
13+ > ,
14+ 'ref' | 'options' | 'mixins' | 'externalClasses'
15+ >
16+ > ;
617 /**
718 * Mixin() 返回值
819 */
920 type IMixinIdentifier = string ;
1021
11- type IMixinDefinitionFilter = < T extends Component . IOptions < any , any , any , any , any > | IMixinOptions < any , any , any , any , any , any > | Page . IOptions < any , any > > (
22+ type IMixinDefinitionFilter = <
23+ T extends
24+ | Component . IOptions < any , any , any , any , any >
25+ | IMixinOptions < any , any , any , any , any , any >
26+ | Page . IOptions < any , any >
27+ > (
1228 /** 使用该 mixin 的 component/mixin 的定义对象 */
1329 defFields : T ,
1430 /** 该 mixin 所使用的 mixin 的 definitionFilter 函数列表 */
1531 definitionFilterArr ?: IMixinDefinitionFilter [ ] | void
16- ) => void
32+ ) => void ;
1733
1834 /**
1935 * Mixin构造器参数
@@ -25,29 +41,39 @@ declare namespace MiniProgram.Mixin {
2541 ExtraThis ,
2642 ExtraOptions extends UnknownRecord ,
2743 Mixins extends Array < ReturnType < Constructor > >
28- > = {
29- [ P in keyof ExtraOptions ] : P extends keyof Component . IOptions <
30- Data ,
31- Props ,
32- Methods ,
33- ExtraOptions ,
34- Mixins
35- > | 'definitionFilter' | 'mixins'
44+ > = {
45+ [ P in keyof ExtraOptions ] : P extends
46+ | keyof Component . IOptions < Data , Props , Methods , ExtraOptions , Mixins >
47+ | 'definitionFilter'
48+ | 'mixins'
3649 ? unknown
3750 : ExtraOptions [ P ] ;
38- } & Omit < Partial < Component . IOptions < Data , Props , Methods , ExtraOptions , IMixinIdentifier [ ] > > , 'ref' | 'options' | 'externalClasses' > & Partial < {
39- /**
40- * 定义段过滤器,用于自定义组件扩展
41- */
42- definitionFilter : IMixinDefinitionFilter ,
51+ } & Omit <
52+ Partial <
53+ Component . IOptions < Data , Props , Methods , ExtraOptions , IMixinIdentifier [ ] >
54+ > ,
55+ 'ref' | 'options' | 'externalClasses'
56+ > &
57+ Partial < {
58+ /**
59+ * 定义段过滤器,用于自定义组件扩展
60+ */
61+ definitionFilter : IMixinDefinitionFilter ;
4362 /**
44- * 组件间代码复用,用于Mixin()的mixins 只支持传入Mixin()注册生成的返回值。不支持传入 js Object
45- */
46- mixins : Mixins
63+ * 组件间代码复用,用于Mixin()的mixins 只支持传入Mixin()注册生成的返回值。不支持传入 js Object
64+ */
65+ mixins : Mixins ;
4766 } > &
4867 ThisType <
49- Component . IInstance < Data , Props , Methods , ExtraThis , ExtraOptions , IMixinIdentifier [ ] >
50- > ;
68+ Component . IInstance <
69+ Data ,
70+ Props ,
71+ Methods ,
72+ ExtraThis ,
73+ ExtraOptions ,
74+ IMixinIdentifier [ ]
75+ >
76+ > ;
5177
5278 interface Constructor {
5379 <
@@ -57,13 +83,15 @@ declare namespace MiniProgram.Mixin {
5783 ExtraThis = { } ,
5884 ExtraOptions extends Record < string , unknown > = { } ,
5985 Mixins extends IMixinIdentifier [ ] = IMixinIdentifier [ ]
60- > ( options : IMixinOptions <
61- Data ,
62- Props ,
63- Methods ,
64- ExtraThis & IGlobalMiniProgramExtraThis4Component ,
65- ExtraOptions ,
66- Mixins
67- > ) : IMixinIdentifier ;
86+ > (
87+ options : IMixinOptions <
88+ Data ,
89+ Props ,
90+ Methods ,
91+ ExtraThis & IGlobalMiniProgramExtraThis4Component ,
92+ ExtraOptions ,
93+ Mixins
94+ >
95+ ) : IMixinIdentifier ;
6896 }
6997}
0 commit comments