annil 1.6.5 → 1.7.1
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.
- package/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/dist/api/SubComponent/SubInherit/SubInheritConstraint.d.ts +2 -1
- package/package.json +1 -1
- package/src/api/SubComponent/SubInherit/SubInheritConstraint.ts +4 -2
- package/src/api/SubComponent/SubInherit/test/error.test.ts +8 -0
- package/src/api/SubComponent/SubInherit/test/normal.test.ts +11 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,20 @@
|
|
|
4
4
|
|
|
5
5
|
* 解决DetailedType不接收接口类型的错误 ([ae8acbf](https://github.com/missannil/annil/commit/ae8acbfc2e62f99db565c448ad9253aa549e78bb))
|
|
6
6
|
|
|
7
|
+
## [1.7.1](https://github.com/missannil/annil/compare/v1.7.0...v1.7.1) (2024-04-12)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* 1.7.0action发布时npm密钥过期问题 ([0ad71b9](https://github.com/missannil/annil/commit/0ad71b96aaa02668a4052cd57ea2ff8c46598107))
|
|
13
|
+
|
|
14
|
+
## [1.7.0](https://github.com/missannil/annil/compare/v1.6.5...v1.7.0) (2024-04-11)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* subComponent的inherit字段加入数组类型,表示联合类型 ([a7930ff](https://github.com/missannil/annil/commit/a7930ff1abe18579bff6f1746911c2f30274325b))
|
|
20
|
+
|
|
7
21
|
## [1.6.5](https://github.com/missannil/annil/compare/v1.6.4...v1.6.5) (2024-02-13)
|
|
8
22
|
|
|
9
23
|
|
package/README.md
CHANGED
|
@@ -2,7 +2,8 @@ import type { SelectKeys } from "hry-types/src/Object/_api";
|
|
|
2
2
|
import type { RemoveInnerData } from "../../../types/RemoveInnerData";
|
|
3
3
|
import type { ComponentDoc } from "../../DefineComponent/ReturnType/ComponentDoc";
|
|
4
4
|
type WXMLSign = "wxml";
|
|
5
|
+
type unionAddList<Keys extends string> = Keys | Keys[];
|
|
5
6
|
export type InheritConstraint<AllRootData extends object, TComponentDoc extends ComponentDoc> = {
|
|
6
|
-
[k in keyof TComponentDoc["properties"]]?: RemoveInnerData<SelectKeys<AllRootData, TComponentDoc["properties"][k]> & string
|
|
7
|
+
[k in keyof TComponentDoc["properties"]]?: unionAddList<RemoveInnerData<SelectKeys<AllRootData, TComponentDoc["properties"][k]> & string>> | WXMLSign;
|
|
7
8
|
};
|
|
8
9
|
export {};
|
package/package.json
CHANGED
|
@@ -4,12 +4,14 @@ import type { ComponentDoc } from "../../DefineComponent/ReturnType/ComponentDoc
|
|
|
4
4
|
|
|
5
5
|
type WXMLSign = "wxml";
|
|
6
6
|
|
|
7
|
+
type unionAddList<Keys extends string> = Keys | Keys[];
|
|
8
|
+
|
|
7
9
|
/**
|
|
8
|
-
* 子组件inherit字段约束,key为构建组件所需的properties字段,类型为根组件数据的key或`WXMLSign`。要求根数据类型为子数据类型的子类型。当key的值来自wxml(循环产生的子数据等情况)时用`WXMLSign`表示。
|
|
10
|
+
* 子组件inherit字段约束,key为构建组件所需的properties字段,类型为根组件数据的key或key[]或`WXMLSign`。要求根数据类型为子数据类型的子类型。当key的值来自wxml(循环产生的子数据等情况)时用`WXMLSign`表示。
|
|
9
11
|
* @returns object
|
|
10
12
|
*/
|
|
11
13
|
export type InheritConstraint<AllRootData extends object, TComponentDoc extends ComponentDoc> = {
|
|
12
14
|
[k in keyof TComponentDoc["properties"]]?:
|
|
13
|
-
| RemoveInnerData<SelectKeys<AllRootData, TComponentDoc["properties"][k]> & string
|
|
15
|
+
| unionAddList<RemoveInnerData<SelectKeys<AllRootData, TComponentDoc["properties"][k]> & string>>
|
|
14
16
|
| WXMLSign;
|
|
15
17
|
};
|
|
@@ -54,3 +54,14 @@ SubComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
|
54
54
|
aaa_obj1: "" as "required_obj" | "optional_obj" | "wxml",
|
|
55
55
|
},
|
|
56
56
|
});
|
|
57
|
+
|
|
58
|
+
// 3 value为数组时,表示多个字段的联合类型
|
|
59
|
+
|
|
60
|
+
SubComponent<Mock_RootDoc, Mock_CompDoc>()({
|
|
61
|
+
inherit: {
|
|
62
|
+
aaa_num: ["optional_literal_num", "required_num"],
|
|
63
|
+
aaa_str: ["literal_str", "str"],
|
|
64
|
+
aaa_obj: "" as "required_obj" | "optional_obj" | ["required_obj" | "optional_obj"] | "wxml",
|
|
65
|
+
aaa_obj1: "" as "required_obj" | "optional_obj" | ["required_obj" | "optional_obj"] | "wxml",
|
|
66
|
+
},
|
|
67
|
+
});
|