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.
Files changed (50) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.js +3 -2
  3. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.js.map +1 -1
  4. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.d.ts +0 -1
  5. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.js +2 -13
  6. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.js.map +1 -1
  7. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/initComputed.js +3 -2
  8. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/initComputed.js.map +1 -1
  9. package/dist/api/DefineComponent/assignOptions/index.js +0 -8
  10. package/dist/api/DefineComponent/assignOptions/index.js.map +1 -1
  11. package/dist/api/InstanceInject/instanceConfig.d.ts +5 -2
  12. package/dist/api/InstanceInject/instanceConfig.js.map +1 -1
  13. package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.d.ts +1 -2
  14. package/dist/api/RootComponent/Instance/RootComponentInstance.d.ts +3 -6
  15. package/dist/api/RootComponent/Observers/ObserversOption.d.ts +2 -3
  16. package/dist/api/RootComponent/Watch/WatchOption.d.ts +2 -3
  17. package/dist/api/RootComponent/index.d.ts +2 -2
  18. package/package.json +1 -1
  19. package/src/api/DefineComponent/ReturnType/test/normalComponentDoc.test.ts +10 -0
  20. package/src/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.ts +3 -3
  21. package/src/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.ts +3 -25
  22. package/src/api/DefineComponent/assignOptions/computedWatchHandle/initComputed.ts +3 -2
  23. package/src/api/DefineComponent/assignOptions/index.ts +12 -12
  24. package/src/api/InstanceInject/instanceConfig.ts +11 -2
  25. package/src/api/RootComponent/Computed/test/normal.test.ts +16 -16
  26. package/src/api/RootComponent/CustomEvents/GetCustomEventDoc.ts +1 -3
  27. package/src/api/RootComponent/CustomEvents/test/GetShortEventDoc.test.ts +1 -2
  28. package/src/api/RootComponent/CustomEvents/test/normal.test.ts +1 -21
  29. package/src/api/RootComponent/Data/test/normal.test.ts +5 -36
  30. package/src/api/RootComponent/Instance/RootComponentInstance.ts +4 -5
  31. package/src/api/RootComponent/Instance/test/properties/mormal.test.ts +9 -4
  32. package/src/api/RootComponent/Observers/ObserversOption.ts +8 -11
  33. package/src/api/RootComponent/Observers/test/normal.test.ts +2 -3
  34. package/src/api/RootComponent/Properties/test/normalEmpty.test.ts +5 -6
  35. package/src/api/RootComponent/Properties/test/normalOptional.test.ts +4 -4
  36. package/src/api/RootComponent/Properties/test/normalRequired.test.ts +4 -4
  37. package/src/api/RootComponent/Watch/WatchOption.ts +17 -23
  38. package/src/api/RootComponent/Watch/test/WatchComputed.test.ts +4 -4
  39. package/src/api/RootComponent/Watch/test/WatchData.test.ts +4 -5
  40. package/src/api/RootComponent/Watch/test/WatchProperties.test.ts +13 -23
  41. package/src/api/RootComponent/index.ts +2 -2
  42. package/src/api/SubComponent/SubComputed/test/normal.test.ts +6 -6
  43. package/src/api/SubComponent/SubData/test/normal.test.ts +5 -5
  44. package/src/api/SubComponent/SubInstance/test/normal.test.ts +4 -4
  45. package/src/api/SubComponent/SubWatch/test/WatchProperties.test.ts +13 -23
  46. package/src/api/SubComponent/SubWatch/test/WatchRootData.test.ts +10 -11
  47. package/src/api/RootComponent/Instance/test/cloneData/error.test.ts +0 -31
  48. package/src/api/RootComponent/Instance/test/cloneData/normal.test.ts +0 -53
  49. package/src/api/SubComponent/SubInstance/test/cloneData/error.test.ts +0 -22
  50. 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
- import type { ReadonlyDeep } from "hry-types/src/Any/ReadonlyDeep";
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<readonly [string, number, boolean], typeof newValue, Test.Pass>;
73
+ Checking<[string, number, boolean], typeof newValue, Test.Pass>;
84
74
 
85
- Checking<readonly [string, number, boolean], typeof oldValue, Test.Pass>;
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<readonly number[] | readonly string[], typeof newValue, Test.Pass>;
93
+ Checking<number[] | string[], typeof newValue, Test.Pass>;
104
94
 
105
- Checking<readonly number[] | readonly string[], typeof oldValue, Test.Pass>;
95
+ Checking<number[] | string[], typeof oldValue, Test.Pass>;
106
96
  },
107
97
  union_obj(newValue, oldValue) {
108
- Checking<ReadonlyDeep<Mock_User | Mock_Cart>, typeof newValue, Test.Pass>;
98
+ Checking<Mock_User | Mock_Cart, typeof newValue, Test.Pass>;
109
99
 
110
- Checking<ReadonlyDeep<Mock_User | Mock_Cart | null>, typeof oldValue, Test.Pass>;
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<ReadonlyDeep<number | Mock_User>, typeof newValue, Test.Pass>;
114
+ Checking<number | Mock_User, typeof newValue, Test.Pass>;
125
115
 
126
- Checking<ReadonlyDeep<number | Mock_User | null>, typeof oldValue, Test.Pass>;
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<ReadonlyDeep<Mock_User>, typeof newValue, Test.Pass>;
130
+ Checking<Mock_User, typeof newValue, Test.Pass>;
141
131
 
142
- Checking<ReadonlyDeep<Mock_User | null>, typeof oldValue, Test.Pass>;
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<ReadonlyDeep<Mock_User>, typeof newValue, Test.Pass>;
141
+ Checking<Mock_User, typeof newValue, Test.Pass>;
152
142
 
153
- Checking<ReadonlyDeep<Mock_User | null>, typeof oldValue, Test.Pass>;
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<ReadonlyDeep<Mock_User>, typeof newValue, Test.Pass>;
68
+ Checking<Mock_User, typeof newValue, Test.Pass>;
70
69
 
71
- Checking<ReadonlyDeep<Mock_User | null>, typeof oldValue, Test.Pass>;
70
+ Checking<Mock_User | null, typeof oldValue, Test.Pass>;
72
71
  },
73
72
  optional_obj(newValue, oldValue) {
74
- Checking<ReadonlyDeep<TestObj>, typeof newValue, Test.Pass>;
73
+ Checking<TestObj, typeof newValue, Test.Pass>;
75
74
 
76
- Checking<ReadonlyDeep<TestObj>, typeof oldValue, Test.Pass>;
75
+ Checking<TestObj, typeof oldValue, Test.Pass>;
77
76
  },
78
77
  "optional_obj.**"(newValue, oldValue) {
79
- Checking<ReadonlyDeep<TestObj>, typeof newValue, Test.Pass>;
78
+ Checking<TestObj, typeof newValue, Test.Pass>;
80
79
 
81
- Checking<ReadonlyDeep<TestObj>, typeof oldValue, Test.Pass>;
80
+ Checking<TestObj, typeof oldValue, Test.Pass>;
82
81
  },
83
82
  "optional_obj.subObj"(newValue, oldValue) {
84
- Checking<ReadonlyDeep<Mock_User>, typeof newValue, Test.Pass>;
83
+ Checking<Mock_User, typeof newValue, Test.Pass>;
85
84
 
86
- Checking<ReadonlyDeep<Mock_User>, typeof oldValue, Test.Pass>;
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<readonly string[], typeof newValue, Test.Pass>;
106
+ Checking<string[], typeof newValue, Test.Pass>;
108
107
 
109
- Checking<readonly string[], typeof oldValue, Test.Pass>;
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
- });