annil 1.5.5 → 1.5.6
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
CHANGED
|
@@ -4,6 +4,13 @@
|
|
|
4
4
|
|
|
5
5
|
* 解决DetailedType不接收接口类型的错误 ([ae8acbf](https://github.com/missannil/annil/commit/ae8acbfc2e62f99db565c448ad9253aa549e78bb))
|
|
6
6
|
|
|
7
|
+
## [1.5.6](https://github.com/missannil/annil/compare/v1.5.5...v1.5.6) (2024-01-03)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* 修复RootCOmonent在properties的可选数组类型时,value验证错误的问题 ([b836e83](https://github.com/missannil/annil/commit/b836e83916a6649b004646893ad91350787c9421))
|
|
13
|
+
|
|
7
14
|
## [1.5.5](https://github.com/missannil/annil/compare/v1.5.4...v1.5.5) (2024-01-01)
|
|
8
15
|
|
|
9
16
|
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import type { EmptyObject } from "hry-types/src/Misc/EmptyObject";
|
|
2
|
+
import type { NonReadonly } from "hry-types/src/Object/NonReadonly";
|
|
2
3
|
import type { InferDetailedType } from "../../../types/InferDetailedType";
|
|
3
4
|
export type PropertiesValueValidator<TProperties, Result = {
|
|
4
5
|
[k in keyof TProperties as TProperties[k] extends {
|
|
5
6
|
type: infer R;
|
|
6
7
|
value: infer V;
|
|
7
|
-
} ? V extends InferDetailedType<R
|
|
8
|
+
} ? NonReadonly<V> extends NonReadonly<InferDetailedType<R>> ? never : k : never]: {
|
|
8
9
|
value: () => "⚠️类型错误⚠️";
|
|
9
10
|
};
|
|
10
11
|
}> = EmptyObject extends Result ? unknown : Result;
|
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { EmptyObject } from "hry-types/src/Misc/EmptyObject";
|
|
2
|
+
import type { NonReadonly } from "hry-types/src/Object/NonReadonly";
|
|
2
3
|
import type { InferDetailedType } from "../../../types/InferDetailedType";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -12,7 +13,7 @@ export type PropertiesValueValidator<
|
|
|
12
13
|
k in keyof TProperties as TProperties[k] extends {
|
|
13
14
|
type: infer R;
|
|
14
15
|
value: infer V;
|
|
15
|
-
} ? V extends InferDetailedType<R
|
|
16
|
+
} ? NonReadonly<V> extends NonReadonly<InferDetailedType<R>> ? never
|
|
16
17
|
: k
|
|
17
18
|
: never
|
|
18
19
|
]: { value: () => "⚠️类型错误⚠️" };
|
|
@@ -20,7 +20,7 @@ const OptionalDoc = RootComponent()({
|
|
|
20
20
|
},
|
|
21
21
|
optional_tuple: {
|
|
22
22
|
type: Array as unknown as DetailedType<[number, string, boolean]>, // 元组类型
|
|
23
|
-
value: [1, "a", true]
|
|
23
|
+
value: [1, "a", true],
|
|
24
24
|
},
|
|
25
25
|
optional_obj: {
|
|
26
26
|
type: Object as DetailedType<Mock_User>, // 对象类型
|
|
@@ -38,6 +38,10 @@ const OptionalDoc = RootComponent()({
|
|
|
38
38
|
value: "string",
|
|
39
39
|
optionalTypes: [Number],
|
|
40
40
|
},
|
|
41
|
+
optional_arr: {
|
|
42
|
+
type: Array as DetailedType<string[]>,
|
|
43
|
+
value: [],
|
|
44
|
+
},
|
|
41
45
|
},
|
|
42
46
|
methods: {
|
|
43
47
|
foo() {
|
|
@@ -52,6 +56,7 @@ const OptionalDoc = RootComponent()({
|
|
|
52
56
|
optional_obj: Mock_User | null;
|
|
53
57
|
optional_objOrNull: Mock_User | null;
|
|
54
58
|
optional_union: string | number;
|
|
59
|
+
optional_arr: string[];
|
|
55
60
|
} & IInjectData
|
|
56
61
|
>,
|
|
57
62
|
Test.Pass
|
|
@@ -69,6 +74,7 @@ type OptionalDocExpected = {
|
|
|
69
74
|
optional_obj?: Mock_User | null;
|
|
70
75
|
optional_objOrNull?: Mock_User | null;
|
|
71
76
|
optional_union?: string | number;
|
|
77
|
+
optional_arr?: string[];
|
|
72
78
|
};
|
|
73
79
|
methods: {
|
|
74
80
|
foo(): void;
|