@mpxjs/core 2.8.47 → 2.8.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/@types/index.d.ts +17 -9
  2. package/package.json +2 -2
package/@types/index.d.ts CHANGED
@@ -31,18 +31,22 @@ type ArrayType<T extends any[]> = T extends Array<infer R> ? R : never;
31
31
  // Mpx types
32
32
  type Data = object | (() => object)
33
33
 
34
- type PropType = StringConstructor | NumberConstructor | BooleanConstructor | ObjectConstructor | ArrayConstructor | null
34
+ type PropConstructor<T = any> = {
35
+ new (...args: any[]): T & {};
36
+ } | {
37
+ (): T;
38
+ }
35
39
 
36
- interface PropOpt {
37
- type: PropType
38
- optionalTypes?: Array<PropType>
39
- value?: any
40
+ export type PropType<T> = PropConstructor<T>
40
41
 
41
- observer? (value: any, old: any, changedPath: string): void
42
+ type FullPropType<T> = {
43
+ type: PropType<T>;
44
+ value?: T;
45
+ optionalTypes?: PropType<T>[];
42
46
  }
43
47
 
44
48
  interface Properties {
45
- [key: string]: WechatMiniprogram.Component.AllProperty
49
+ [key: string]: WechatMiniprogram.Component.AllProperty | PropType<any> | FullPropType<any>
46
50
  }
47
51
 
48
52
  interface Methods {
@@ -78,8 +82,12 @@ type PropValueType<Def> = Def extends {
78
82
  }
79
83
  ? T
80
84
  : Def extends (...args: any[]) => infer T
81
- ? T
82
- : any;
85
+ ? T
86
+ : Def extends FullPropType<infer T>
87
+ ? T
88
+ : Def extends PropType<infer T>
89
+ ? T
90
+ : any;
83
91
 
84
92
  type GetPropsType<T> = {
85
93
  readonly [K in keyof T]: PropValueType<T[K]>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mpxjs/core",
3
- "version": "2.8.47",
3
+ "version": "2.8.48",
4
4
  "description": "mpx runtime core",
5
5
  "keywords": [
6
6
  "miniprogram",
@@ -47,5 +47,5 @@
47
47
  "url": "https://github.com/didi/mpx/issues"
48
48
  },
49
49
  "sideEffects": false,
50
- "gitHead": "9069d7f3931841a7e3acaf990464813a3b6ccb0c"
50
+ "gitHead": "4cbd364322aadc0e9727a0d852ca3ca1c8e0b1ca"
51
51
  }