annil 1.6.0 → 1.6.2
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 +15 -0
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.js +3 -2
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.js.map +1 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.d.ts +0 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.js +2 -13
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.js.map +1 -1
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/initComputed.js +3 -2
- package/dist/api/DefineComponent/assignOptions/computedWatchHandle/initComputed.js.map +1 -1
- package/dist/api/DefineComponent/assignOptions/index.js +0 -8
- package/dist/api/DefineComponent/assignOptions/index.js.map +1 -1
- package/dist/api/InstanceInject/instanceConfig.d.ts +5 -2
- package/dist/api/InstanceInject/instanceConfig.js.map +1 -1
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.d.ts +1 -2
- package/dist/api/RootComponent/Instance/RootComponentInstance.d.ts +3 -6
- package/dist/api/RootComponent/Observers/ObserversOption.d.ts +2 -3
- package/dist/api/RootComponent/Watch/WatchOption.d.ts +2 -3
- package/dist/api/RootComponent/index.d.ts +2 -2
- package/package.json +1 -1
- package/src/api/DefineComponent/ReturnType/test/normalComponentDoc.test.ts +10 -0
- package/src/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.ts +3 -3
- package/src/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.ts +3 -25
- package/src/api/DefineComponent/assignOptions/computedWatchHandle/initComputed.ts +3 -2
- package/src/api/DefineComponent/assignOptions/index.ts +12 -12
- package/src/api/InstanceInject/instanceConfig.ts +11 -2
- package/src/api/RootComponent/Computed/test/normal.test.ts +16 -16
- package/src/api/RootComponent/CustomEvents/GetCustomEventDoc.ts +1 -3
- package/src/api/RootComponent/CustomEvents/test/GetShortEventDoc.test.ts +1 -2
- package/src/api/RootComponent/CustomEvents/test/normal.test.ts +1 -21
- package/src/api/RootComponent/Data/test/normal.test.ts +5 -36
- package/src/api/RootComponent/Instance/RootComponentInstance.ts +4 -5
- package/src/api/RootComponent/Instance/test/properties/mormal.test.ts +9 -4
- package/src/api/RootComponent/Observers/ObserversOption.ts +8 -11
- package/src/api/RootComponent/Observers/test/normal.test.ts +2 -3
- package/src/api/RootComponent/Properties/test/normalEmpty.test.ts +5 -6
- package/src/api/RootComponent/Properties/test/normalOptional.test.ts +4 -4
- package/src/api/RootComponent/Properties/test/normalRequired.test.ts +4 -4
- package/src/api/RootComponent/Watch/WatchOption.ts +17 -23
- package/src/api/RootComponent/Watch/test/WatchComputed.test.ts +4 -4
- package/src/api/RootComponent/Watch/test/WatchData.test.ts +4 -5
- package/src/api/RootComponent/Watch/test/WatchProperties.test.ts +13 -23
- package/src/api/RootComponent/index.ts +2 -2
- package/src/api/SubComponent/SubComputed/test/normal.test.ts +6 -6
- package/src/api/SubComponent/SubData/test/normal.test.ts +5 -5
- package/src/api/SubComponent/SubInstance/test/normal.test.ts +4 -4
- package/src/api/SubComponent/SubWatch/test/WatchProperties.test.ts +13 -23
- package/src/api/SubComponent/SubWatch/test/WatchRootData.test.ts +10 -11
- package/src/api/RootComponent/Instance/test/cloneData/error.test.ts +0 -31
- package/src/api/RootComponent/Instance/test/cloneData/normal.test.ts +0 -53
- package/src/api/SubComponent/SubInstance/test/cloneData/error.test.ts +0 -22
- package/src/api/SubComponent/SubInstance/test/cloneData/normal.test.ts +0 -73
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
import { type DetailedType, RootComponent, SubComponent } from "../../../..";
|
|
4
4
|
import type { OptionalType } from "../../../RootComponent/Properties/PropertiesConstraint";
|
|
5
5
|
import {
|
|
@@ -63,26 +63,16 @@ SubComponent<Root, { properties: { aaa_num: number } }>()({
|
|
|
63
63
|
|
|
64
64
|
Checking<boolean, typeof oldValue, Test.Pass>;
|
|
65
65
|
},
|
|
66
|
-
arr(newValue, oldValue) {
|
|
67
|
-
newValue; // readonly ReadonlyDeep<unknown>[]
|
|
68
|
-
|
|
69
|
-
oldValue; // readonly ReadonlyDeep<unknown>[]
|
|
70
66
|
|
|
71
|
-
// ts中很多不是错误的错误,写 typeof newValue 结果是错误
|
|
72
|
-
Checking<unknown[], typeof newValue, Test.Fail>;
|
|
73
|
-
|
|
74
|
-
// ts中很多不是错误的错误,写 readonly ReadonlyDeep<unknown>[] 结果是正确的
|
|
75
|
-
Checking<readonly unknown[], readonly ReadonlyDeep<unknown>[], Test.Pass>;
|
|
76
|
-
},
|
|
77
67
|
obj(newValue, oldValue) {
|
|
78
68
|
Checking<object, typeof newValue, Test.Pass>;
|
|
79
69
|
|
|
80
70
|
Checking<object | null, typeof oldValue, Test.Pass>;
|
|
81
71
|
},
|
|
82
72
|
tuple(newValue, oldValue) {
|
|
83
|
-
Checking<
|
|
73
|
+
Checking<[string, number, boolean], typeof newValue, Test.Pass>;
|
|
84
74
|
|
|
85
|
-
Checking<
|
|
75
|
+
Checking<[string, number, boolean], typeof oldValue, Test.Pass>;
|
|
86
76
|
},
|
|
87
77
|
union_str(newValue, oldValue) {
|
|
88
78
|
Checking<"male" | "female", typeof newValue, Test.Pass>;
|
|
@@ -100,14 +90,14 @@ SubComponent<Root, { properties: { aaa_num: number } }>()({
|
|
|
100
90
|
Checking<false | true, typeof oldValue, Test.Pass>;
|
|
101
91
|
},
|
|
102
92
|
union_arr(newValue, oldValue) {
|
|
103
|
-
Checking<
|
|
93
|
+
Checking<number[] | string[], typeof newValue, Test.Pass>;
|
|
104
94
|
|
|
105
|
-
Checking<
|
|
95
|
+
Checking<number[] | string[], typeof oldValue, Test.Pass>;
|
|
106
96
|
},
|
|
107
97
|
union_obj(newValue, oldValue) {
|
|
108
|
-
Checking<
|
|
98
|
+
Checking<Mock_User | Mock_Cart, typeof newValue, Test.Pass>;
|
|
109
99
|
|
|
110
|
-
Checking<
|
|
100
|
+
Checking<Mock_User | Mock_Cart | null, typeof oldValue, Test.Pass>;
|
|
111
101
|
},
|
|
112
102
|
// 必传多类型联合
|
|
113
103
|
union_str_num_bool(newValue, oldValue) {
|
|
@@ -121,9 +111,9 @@ SubComponent<Root, { properties: { aaa_num: number } }>()({
|
|
|
121
111
|
Checking<0 | 1 | 2 | "male" | "female", typeof oldValue, Test.Pass>;
|
|
122
112
|
},
|
|
123
113
|
union_mockUser_num(newValue, oldValue) {
|
|
124
|
-
Checking<
|
|
114
|
+
Checking<number | Mock_User, typeof newValue, Test.Pass>;
|
|
125
115
|
|
|
126
|
-
Checking<
|
|
116
|
+
Checking<number | Mock_User | null, typeof oldValue, Test.Pass>;
|
|
127
117
|
},
|
|
128
118
|
// 可选字段
|
|
129
119
|
optional_gender(newValue, oldValue) {
|
|
@@ -137,9 +127,9 @@ SubComponent<Root, { properties: { aaa_num: number } }>()({
|
|
|
137
127
|
Checking<number, typeof oldValue, Test.Pass>;
|
|
138
128
|
},
|
|
139
129
|
optional_obj(newValue, oldValue) {
|
|
140
|
-
Checking<
|
|
130
|
+
Checking<Mock_User, typeof newValue, Test.Pass>;
|
|
141
131
|
|
|
142
|
-
Checking<
|
|
132
|
+
Checking<Mock_User | null, typeof oldValue, Test.Pass>;
|
|
143
133
|
},
|
|
144
134
|
// 对象的二段key
|
|
145
135
|
"optional_obj.age"(newValue, oldValue) {
|
|
@@ -148,9 +138,9 @@ SubComponent<Root, { properties: { aaa_num: number } }>()({
|
|
|
148
138
|
Checking<number | undefined, typeof oldValue, Test.Pass>;
|
|
149
139
|
},
|
|
150
140
|
"optional_obj.**"(newValue, oldValue) {
|
|
151
|
-
Checking<
|
|
141
|
+
Checking<Mock_User, typeof newValue, Test.Pass>;
|
|
152
142
|
|
|
153
|
-
Checking<
|
|
143
|
+
Checking<Mock_User | null, typeof oldValue, Test.Pass>;
|
|
154
144
|
},
|
|
155
145
|
"optional_obj.id"(newValue, oldValue) {
|
|
156
146
|
Checking<string, typeof newValue, Test.Pass>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Checking, type Test } from "hry-types";
|
|
2
2
|
|
|
3
|
-
import type { ReadonlyDeep } from "hry-types/src/Any/_api";
|
|
4
3
|
import type { ComponentDoc } from "../../../DefineComponent/ReturnType/ComponentDoc";
|
|
5
4
|
|
|
6
5
|
import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
|
|
@@ -66,24 +65,24 @@ SubComponent<RootDoc, CompDoc>()({
|
|
|
66
65
|
Checking<string | number, typeof oldValue, Test.Pass>;
|
|
67
66
|
},
|
|
68
67
|
required_obj(newValue, oldValue) {
|
|
69
|
-
Checking<
|
|
68
|
+
Checking<Mock_User, typeof newValue, Test.Pass>;
|
|
70
69
|
|
|
71
|
-
Checking<
|
|
70
|
+
Checking<Mock_User | null, typeof oldValue, Test.Pass>;
|
|
72
71
|
},
|
|
73
72
|
optional_obj(newValue, oldValue) {
|
|
74
|
-
Checking<
|
|
73
|
+
Checking<TestObj, typeof newValue, Test.Pass>;
|
|
75
74
|
|
|
76
|
-
Checking<
|
|
75
|
+
Checking<TestObj, typeof oldValue, Test.Pass>;
|
|
77
76
|
},
|
|
78
77
|
"optional_obj.**"(newValue, oldValue) {
|
|
79
|
-
Checking<
|
|
78
|
+
Checking<TestObj, typeof newValue, Test.Pass>;
|
|
80
79
|
|
|
81
|
-
Checking<
|
|
80
|
+
Checking<TestObj, typeof oldValue, Test.Pass>;
|
|
82
81
|
},
|
|
83
82
|
"optional_obj.subObj"(newValue, oldValue) {
|
|
84
|
-
Checking<
|
|
83
|
+
Checking<Mock_User, typeof newValue, Test.Pass>;
|
|
85
84
|
|
|
86
|
-
Checking<
|
|
85
|
+
Checking<Mock_User, typeof oldValue, Test.Pass>;
|
|
87
86
|
},
|
|
88
87
|
"required_obj.age"(newValue, oldValue) {
|
|
89
88
|
Checking<number, typeof newValue, Test.Pass>;
|
|
@@ -104,9 +103,9 @@ SubComponent<RootDoc, CompDoc>()({
|
|
|
104
103
|
Checking<string, typeof oldValue, Test.Pass>;
|
|
105
104
|
},
|
|
106
105
|
arr(newValue, oldValue) {
|
|
107
|
-
Checking<
|
|
106
|
+
Checking<string[], typeof newValue, Test.Pass>;
|
|
108
107
|
|
|
109
|
-
Checking<
|
|
108
|
+
Checking<string[], typeof oldValue, Test.Pass>;
|
|
110
109
|
},
|
|
111
110
|
|
|
112
111
|
literal_str(newValue, oldValue) {
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { DetailedType } from "../../../../..";
|
|
2
|
-
import { RootComponent } from "../../..";
|
|
3
|
-
|
|
4
|
-
interface User {
|
|
5
|
-
readonly id: number;
|
|
6
|
-
readonly name: string;
|
|
7
|
-
slected: boolean;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
RootComponent()({
|
|
11
|
-
properties: {
|
|
12
|
-
num: Number,
|
|
13
|
-
user: Object as DetailedType<User>,
|
|
14
|
-
},
|
|
15
|
-
data: {
|
|
16
|
-
str: "123",
|
|
17
|
-
arr: [{}] as User[],
|
|
18
|
-
},
|
|
19
|
-
|
|
20
|
-
methods: {
|
|
21
|
-
M1() {
|
|
22
|
-
const cloneData = this.cloneData;
|
|
23
|
-
|
|
24
|
-
// @ts-expect-error 尽管cloneData去除了readonly,user.id属性依然是readonly
|
|
25
|
-
cloneData.user!.id = 1;
|
|
26
|
-
|
|
27
|
-
// @ts-expect-error arr[0].name属性依然是readonly
|
|
28
|
-
cloneData.arr[0].name = "zhao";
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
});
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import type { _ReadonlyDeep } from "hry-types/src/Any/_api";
|
|
3
|
-
import type { DetailedType } from "../../../../..";
|
|
4
|
-
import { RootComponent } from "../../..";
|
|
5
|
-
|
|
6
|
-
interface User {
|
|
7
|
-
readonly id: number;
|
|
8
|
-
readonly name: string;
|
|
9
|
-
slected: boolean;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
RootComponent()({
|
|
13
|
-
properties: {
|
|
14
|
-
num: Number,
|
|
15
|
-
obj: Object as DetailedType<User>,
|
|
16
|
-
},
|
|
17
|
-
data: {
|
|
18
|
-
str: "123",
|
|
19
|
-
arr: [{}] as User[],
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
methods: {
|
|
23
|
-
M1() {
|
|
24
|
-
Checking<
|
|
25
|
-
typeof this.data,
|
|
26
|
-
_ReadonlyDeep<
|
|
27
|
-
{
|
|
28
|
-
injectTheme: "dark" | "light" | undefined;
|
|
29
|
-
injectStr: string;
|
|
30
|
-
str: string;
|
|
31
|
-
arr: User[];
|
|
32
|
-
num: number;
|
|
33
|
-
obj: User | null;
|
|
34
|
-
}
|
|
35
|
-
>,
|
|
36
|
-
Test.Pass
|
|
37
|
-
>;
|
|
38
|
-
|
|
39
|
-
Checking<
|
|
40
|
-
typeof this.cloneData,
|
|
41
|
-
{
|
|
42
|
-
injectTheme: "dark" | "light" | undefined;
|
|
43
|
-
injectStr: string;
|
|
44
|
-
str: string;
|
|
45
|
-
arr: User[];
|
|
46
|
-
num: number;
|
|
47
|
-
obj: User | null;
|
|
48
|
-
},
|
|
49
|
-
Test.Pass
|
|
50
|
-
>;
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
});
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import type { View } from "../../../../../thirdLib/wm";
|
|
2
|
-
import type { RootComponentDoc } from "../../../../RootComponent/RootComponentDoc";
|
|
3
|
-
import { SubComponent } from "../../..";
|
|
4
|
-
|
|
5
|
-
type RootDoc = RootComponentDoc<{
|
|
6
|
-
events: {
|
|
7
|
-
RootE1: () => string;
|
|
8
|
-
};
|
|
9
|
-
}>;
|
|
10
|
-
|
|
11
|
-
// 实例中只存在RootDoc和自身的methods字段
|
|
12
|
-
SubComponent<RootDoc, View>()({
|
|
13
|
-
lifetimes: {
|
|
14
|
-
created() {
|
|
15
|
-
// @ts-expect-error 不存在的方法 (Root事件方法不可调用)
|
|
16
|
-
this.RootE1;
|
|
17
|
-
|
|
18
|
-
// @ts-expect-error 不存在的方法
|
|
19
|
-
this.otherMethods();
|
|
20
|
-
},
|
|
21
|
-
},
|
|
22
|
-
});
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { Checking, type Test } from "hry-types";
|
|
2
|
-
import type { ComponentDoc } from "../../../../DefineComponent/ReturnType/ComponentDoc";
|
|
3
|
-
import type { Mock_User } from "../../../../RootComponent/Properties/test/normalRequired.test";
|
|
4
|
-
import type { RootComponentDoc } from "../../../../RootComponent/RootComponentDoc";
|
|
5
|
-
import { SubComponent } from "../../..";
|
|
6
|
-
|
|
7
|
-
type RootDoc = RootComponentDoc<{
|
|
8
|
-
properties: {
|
|
9
|
-
Pstr: string;
|
|
10
|
-
Pobj: Mock_User | null;
|
|
11
|
-
PoptionalObj?: Mock_User;
|
|
12
|
-
};
|
|
13
|
-
data: {
|
|
14
|
-
Dnum: number;
|
|
15
|
-
};
|
|
16
|
-
computed: {
|
|
17
|
-
Cnum: number;
|
|
18
|
-
};
|
|
19
|
-
methods: {
|
|
20
|
-
RootM: () => number;
|
|
21
|
-
};
|
|
22
|
-
customEvents: {
|
|
23
|
-
RootCus: string;
|
|
24
|
-
};
|
|
25
|
-
events: {
|
|
26
|
-
RootE1: () => string;
|
|
27
|
-
};
|
|
28
|
-
}>;
|
|
29
|
-
|
|
30
|
-
type CompDoc = ComponentDoc<{
|
|
31
|
-
properties: {
|
|
32
|
-
aaa_str: string;
|
|
33
|
-
};
|
|
34
|
-
customEvents: {
|
|
35
|
-
aaa_num: number;
|
|
36
|
-
};
|
|
37
|
-
}>;
|
|
38
|
-
|
|
39
|
-
SubComponent<RootDoc, CompDoc>()({
|
|
40
|
-
data: {
|
|
41
|
-
aaa_str: "str",
|
|
42
|
-
_aaa_num: 123,
|
|
43
|
-
},
|
|
44
|
-
computed: {
|
|
45
|
-
_aaa_isReady() {
|
|
46
|
-
return false;
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
|
|
50
|
-
lifetimes: {
|
|
51
|
-
created() {
|
|
52
|
-
Checking<
|
|
53
|
-
typeof this.cloneData,
|
|
54
|
-
{
|
|
55
|
-
// inheritData
|
|
56
|
-
injectTheme: "dark" | "light" | undefined;
|
|
57
|
-
injectStr: string;
|
|
58
|
-
// RootData
|
|
59
|
-
Pstr: string;
|
|
60
|
-
Pobj: Mock_User | null;
|
|
61
|
-
PoptionalObj: Mock_User;
|
|
62
|
-
Dnum: number;
|
|
63
|
-
Cnum: number;
|
|
64
|
-
// 自身Data类型与CompDoc类型相同
|
|
65
|
-
aaa_str: string;
|
|
66
|
-
_aaa_isReady: boolean;
|
|
67
|
-
_aaa_num: number;
|
|
68
|
-
},
|
|
69
|
-
Test.Pass
|
|
70
|
-
>;
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
});
|