annil 1.6.1 → 1.6.3

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 (53) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.js +4 -4
  3. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.js.map +1 -1
  4. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.d.ts +3 -0
  5. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.js +16 -8
  6. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.js.map +1 -1
  7. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/index.js +2 -2
  8. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/index.js.map +1 -1
  9. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/initComputedAndGetCache.d.ts +12 -0
  10. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/{initComputed.js → initComputedAndGetCache.js} +17 -26
  11. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/initComputedAndGetCache.js.map +1 -0
  12. package/dist/api/DefineComponent/assignOptions/index.d.ts +1 -1
  13. package/dist/api/DefineComponent/assignOptions/index.js +0 -8
  14. package/dist/api/DefineComponent/assignOptions/index.js.map +1 -1
  15. package/dist/api/InstanceInject/instanceConfig.d.ts +5 -2
  16. package/dist/api/InstanceInject/instanceConfig.js.map +1 -1
  17. package/dist/api/RootComponent/Instance/RootComponentInstance.d.ts +3 -6
  18. package/dist/api/RootComponent/Observers/ObserversOption.d.ts +2 -3
  19. package/dist/api/RootComponent/Watch/WatchOption.d.ts +2 -3
  20. package/dist/api/RootComponent/index.d.ts +2 -2
  21. package/package.json +1 -1
  22. package/src/api/DefineComponent/assignOptions/computedWatchHandle/computedUpdater.ts +5 -4
  23. package/src/api/DefineComponent/assignOptions/computedWatchHandle/data-tracer.ts +20 -16
  24. package/src/api/DefineComponent/assignOptions/computedWatchHandle/index.ts +9 -5
  25. package/src/api/DefineComponent/assignOptions/computedWatchHandle/{initComputed.ts → initComputedAndGetCache.ts} +38 -57
  26. package/src/api/DefineComponent/assignOptions/index.ts +13 -13
  27. package/src/api/InstanceInject/instanceConfig.ts +11 -2
  28. package/src/api/RootComponent/Computed/test/normal.test.ts +16 -16
  29. package/src/api/RootComponent/CustomEvents/test/normal.test.ts +0 -19
  30. package/src/api/RootComponent/Data/test/normal.test.ts +5 -36
  31. package/src/api/RootComponent/Instance/RootComponentInstance.ts +4 -5
  32. package/src/api/RootComponent/Instance/test/properties/mormal.test.ts +9 -4
  33. package/src/api/RootComponent/Observers/ObserversOption.ts +8 -11
  34. package/src/api/RootComponent/Observers/test/normal.test.ts +2 -3
  35. package/src/api/RootComponent/Properties/test/normalEmpty.test.ts +5 -6
  36. package/src/api/RootComponent/Properties/test/normalOptional.test.ts +4 -4
  37. package/src/api/RootComponent/Properties/test/normalRequired.test.ts +4 -4
  38. package/src/api/RootComponent/Watch/WatchOption.ts +17 -23
  39. package/src/api/RootComponent/Watch/test/WatchComputed.test.ts +4 -4
  40. package/src/api/RootComponent/Watch/test/WatchData.test.ts +4 -5
  41. package/src/api/RootComponent/Watch/test/WatchProperties.test.ts +13 -23
  42. package/src/api/RootComponent/index.ts +2 -2
  43. package/src/api/SubComponent/SubComputed/test/normal.test.ts +6 -6
  44. package/src/api/SubComponent/SubData/test/normal.test.ts +5 -5
  45. package/src/api/SubComponent/SubInstance/test/normal.test.ts +4 -4
  46. package/src/api/SubComponent/SubWatch/test/WatchProperties.test.ts +13 -23
  47. package/src/api/SubComponent/SubWatch/test/WatchRootData.test.ts +10 -11
  48. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/initComputed.d.ts +0 -12
  49. package/dist/api/DefineComponent/assignOptions/computedWatchHandle/initComputed.js.map +0 -1
  50. package/src/api/RootComponent/Instance/test/cloneData/error.test.ts +0 -31
  51. package/src/api/RootComponent/Instance/test/cloneData/normal.test.ts +0 -53
  52. package/src/api/SubComponent/SubInstance/test/cloneData/error.test.ts +0 -22
  53. 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/_api";
2
+
3
3
  import type { DetailedType } from "../../../../types/DetailedType";
4
4
  import { RootComponent } from "../..";
5
5
  import type { Mock_User } from "../../Properties/test/normalRequired.test";
@@ -29,10 +29,10 @@ RootComponent()({
29
29
 
30
30
  Checking<number, typeof oldValue, Test.Pass>;
31
31
  },
32
- Cobj(newValue: ReadonlyDeep<Mock_User>, oldValue: ReadonlyDeep<Mock_User> | null) {
33
- Checking<ReadonlyDeep<Mock_User>, typeof newValue, Test.Pass>;
32
+ Cobj(newValue: Mock_User, oldValue: Mock_User | null) {
33
+ Checking<Mock_User, typeof newValue, Test.Pass>;
34
34
 
35
- Checking<ReadonlyDeep<Mock_User> | null, typeof oldValue, Test.Pass>;
35
+ Checking<Mock_User | null, typeof oldValue, Test.Pass>;
36
36
  },
37
37
  },
38
38
  });
@@ -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 { observable } from "mobx";
5
4
  import { RootComponent } from "../..";
6
5
  import type { Mock_User } from "../../Properties/test/normalRequired.test";
@@ -29,9 +28,9 @@ RootComponent()({
29
28
  Checking<number, typeof oldValue, Test.Pass>;
30
29
  },
31
30
  obj(newValue, oldValue) {
32
- Checking<ReadonlyDeep<Mock_User>, typeof newValue, Test.Pass>;
31
+ Checking<Mock_User, typeof newValue, Test.Pass>;
33
32
 
34
- Checking<ReadonlyDeep<Mock_User>, typeof oldValue, Test.Pass>;
33
+ Checking<Mock_User, typeof oldValue, Test.Pass>;
35
34
  },
36
35
  reactiveNumber(newValue: number, oldValue) {
37
36
  Checking<number, typeof newValue, Test.Pass>;
@@ -44,9 +43,9 @@ RootComponent()({
44
43
  Checking<"male" | "female", typeof oldValue, Test.Pass>;
45
44
  },
46
45
  reactiveUser(newValue, oldValue) {
47
- Checking<ReadonlyDeep<Mock_User>, typeof newValue, Test.Pass>;
46
+ Checking<Mock_User, typeof newValue, Test.Pass>;
48
47
 
49
- Checking<ReadonlyDeep<Mock_User>, typeof oldValue, Test.Pass>;
48
+ Checking<Mock_User, typeof oldValue, Test.Pass>;
50
49
  },
51
50
  },
52
51
  });
@@ -1,5 +1,5 @@
1
1
  import { Checking, type Test } from "hry-types";
2
- import type { ReadonlyDeep } from "hry-types/src/Any/_api";
2
+
3
3
  import type { DetailedType } from "../../../..";
4
4
  import { RootComponent } from "../..";
5
5
  import type { OptionalType } from "../../Properties/PropertiesConstraint";
@@ -58,26 +58,16 @@ RootComponent()({
58
58
 
59
59
  Checking<boolean, typeof oldValue, Test.Pass>;
60
60
  },
61
- arr(newValue, oldValue) {
62
- newValue; // readonly ReadonlyDeep<unknown>[]
63
-
64
- oldValue; // readonly ReadonlyDeep<unknown>[]
65
61
 
66
- // ts中很多不是错误的错误,写 typeof newValue 结果是错误
67
- Checking<unknown[], typeof newValue, Test.Fail>;
68
-
69
- // ts中很多不是错误的错误,写 readonly ReadonlyDeep<unknown>[] 结果是正确的
70
- Checking<readonly unknown[], readonly ReadonlyDeep<unknown>[], Test.Pass>;
71
- },
72
62
  obj(newValue, oldValue) {
73
63
  Checking<object, typeof newValue, Test.Pass>;
74
64
 
75
65
  Checking<object | null, typeof oldValue, Test.Pass>;
76
66
  },
77
67
  tuple(newValue, oldValue) {
78
- Checking<readonly [string, number, boolean], typeof newValue, Test.Pass>;
68
+ Checking<[string, number, boolean], typeof newValue, Test.Pass>;
79
69
 
80
- Checking<readonly [string, number, boolean], typeof oldValue, Test.Pass>;
70
+ Checking<[string, number, boolean], typeof oldValue, Test.Pass>;
81
71
  },
82
72
  union_str(newValue, oldValue) {
83
73
  Checking<"male" | "female", typeof newValue, Test.Pass>;
@@ -95,14 +85,14 @@ RootComponent()({
95
85
  Checking<false | true, typeof oldValue, Test.Pass>;
96
86
  },
97
87
  union_arr(newValue, oldValue) {
98
- Checking<readonly number[] | readonly string[], typeof newValue, Test.Pass>;
88
+ Checking<number[] | string[], typeof newValue, Test.Pass>;
99
89
 
100
- Checking<readonly number[] | readonly string[], typeof oldValue, Test.Pass>;
90
+ Checking<number[] | string[], typeof oldValue, Test.Pass>;
101
91
  },
102
92
  union_obj(newValue, oldValue) {
103
- Checking<ReadonlyDeep<Mock_User | Mock_Cart>, typeof newValue, Test.Pass>;
93
+ Checking<Mock_User | Mock_Cart, typeof newValue, Test.Pass>;
104
94
 
105
- Checking<ReadonlyDeep<Mock_User | Mock_Cart | null>, typeof oldValue, Test.Pass>;
95
+ Checking<Mock_User | Mock_Cart | null, typeof oldValue, Test.Pass>;
106
96
  },
107
97
  // 必传多类型联合
108
98
  union_str_num_bool(newValue, oldValue) {
@@ -116,9 +106,9 @@ RootComponent()({
116
106
  Checking<0 | 1 | 2 | "male" | "female", typeof oldValue, Test.Pass>;
117
107
  },
118
108
  union_mockUser_num(newValue, oldValue) {
119
- Checking<ReadonlyDeep<number | Mock_User>, typeof newValue, Test.Pass>;
109
+ Checking<number | Mock_User, typeof newValue, Test.Pass>;
120
110
 
121
- Checking<ReadonlyDeep<number | Mock_User | null>, typeof oldValue, Test.Pass>;
111
+ Checking<number | Mock_User | null, typeof oldValue, Test.Pass>;
122
112
  },
123
113
  // 可选字段
124
114
  optional_gender(newValue, oldValue) {
@@ -132,9 +122,9 @@ RootComponent()({
132
122
  Checking<number, typeof oldValue, Test.Pass>;
133
123
  },
134
124
  optional_obj(newValue, oldValue) {
135
- Checking<ReadonlyDeep<Mock_User>, typeof newValue, Test.Pass>;
125
+ Checking<Mock_User, typeof newValue, Test.Pass>;
136
126
 
137
- Checking<ReadonlyDeep<Mock_User | null>, typeof oldValue, Test.Pass>;
127
+ Checking<Mock_User | null, typeof oldValue, Test.Pass>;
138
128
  },
139
129
  // 对象的二段key
140
130
  "optional_obj.age"(newValue, oldValue) {
@@ -143,9 +133,9 @@ RootComponent()({
143
133
  Checking<number | undefined, typeof oldValue, Test.Pass>;
144
134
  },
145
135
  "optional_obj.**"(newValue, oldValue) {
146
- Checking<ReadonlyDeep<Mock_User>, typeof newValue, Test.Pass>;
136
+ Checking<Mock_User, typeof newValue, Test.Pass>;
147
137
 
148
- Checking<ReadonlyDeep<Mock_User | null>, typeof oldValue, Test.Pass>;
138
+ Checking<Mock_User | null, typeof oldValue, Test.Pass>;
149
139
  },
150
140
  "optional_obj.id"(newValue, oldValue) {
151
141
  Checking<string, typeof newValue, Test.Pass>;
@@ -5,7 +5,7 @@ import type { ComputeIntersection } from "hry-types/src/Object/_api";
5
5
  import type { ComputeObject } from "../../types/ComputeObj";
6
6
  import type { WMCompOtherOption } from "../../types/OfficialTypeAlias";
7
7
  import type { ComponentDoc } from "../DefineComponent/ReturnType/ComponentDoc";
8
- import type { IInjectData, IInjectStore } from "../InstanceInject/instanceConfig";
8
+ import type { IInjectAllData, IInjectStore } from "../InstanceInject/instanceConfig";
9
9
  import type { ComputedConstraint } from "./Computed/ComputedConstraint";
10
10
  import type { ComputedOption } from "./Computed/ComputedOption";
11
11
  import type { GetComputedDoc } from "./Computed/GetComputedDoc";
@@ -58,7 +58,7 @@ type RootComponentOptions<
58
58
  & ComputedOption<
59
59
  TComputed,
60
60
  keyof (PropertiesDoc & DataDoc & StoreDoc),
61
- { data: ComputeObject<DataDoc & Required<PropertiesDoc> & StoreDoc & ComputedDoc & IInjectData> }
61
+ { data: ComputeObject<DataDoc & Required<PropertiesDoc> & StoreDoc & ComputedDoc & IInjectAllData> }
62
62
  >
63
63
  & PageLifetimesOption<TIsPage, PropertiesDoc>
64
64
  & LifetimesOption
@@ -1,8 +1,8 @@
1
1
  import { Checking, type Test } from "hry-types";
2
- import type { ReadonlyDeep } from "hry-types/src/Any/_api";
3
2
  import type { ComponentDoc } from "../../../DefineComponent/ReturnType/ComponentDoc";
4
3
 
5
- import type { IInjectData } from "../../../InstanceInject/instanceConfig";
4
+ import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
5
+ import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
6
6
  import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
7
7
  import { SubComponent } from "../..";
8
8
 
@@ -81,7 +81,7 @@ SubComponent<Root, OnlyPropsCompDoc>()({
81
81
  // 5 this.data
82
82
  Checking<
83
83
  typeof this.data,
84
- ReadonlyDeep<
84
+ ComputeIntersection<
85
85
  {
86
86
  num: number;
87
87
  user: User | null;
@@ -92,7 +92,7 @@ SubComponent<Root, OnlyPropsCompDoc>()({
92
92
  aaa_num123: 123;
93
93
  aaa_str: "a" | "b";
94
94
  aaa_obj: Mock_User | null;
95
- } & IInjectData
95
+ } & IInjectAllData
96
96
  >,
97
97
  Test.Pass
98
98
  >;
@@ -105,7 +105,7 @@ SubComponent<Root, OnlyPropsCompDoc>()({
105
105
  // 5 this.data 深度只读
106
106
  Checking<
107
107
  typeof this.data,
108
- ReadonlyDeep<
108
+ ComputeIntersection<
109
109
  {
110
110
  num: number;
111
111
  user: User | null;
@@ -116,7 +116,7 @@ SubComponent<Root, OnlyPropsCompDoc>()({
116
116
  aaa_num123: 123;
117
117
  aaa_str: "a" | "b";
118
118
  aaa_obj: Mock_User | null;
119
- } & IInjectData
119
+ } & IInjectAllData
120
120
  >,
121
121
  Test.Pass
122
122
  >;
@@ -1,8 +1,8 @@
1
1
  import { Checking, type Test } from "hry-types";
2
- import type { ReadonlyDeep } from "hry-types/src/Any/_api";
3
2
  import type { ComponentDoc } from "../../../DefineComponent/ReturnType/ComponentDoc";
4
3
 
5
- import type { IInjectData } from "../../../InstanceInject/instanceConfig";
4
+ import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
5
+ import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
6
6
  import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
7
7
  import { SubComponent } from "../..";
8
8
 
@@ -51,13 +51,13 @@ SubComponent<{}, CompDoc>()({
51
51
  // 4 this.data中的data配置数据
52
52
  Checking<
53
53
  typeof this.data,
54
- ReadonlyDeep<
54
+ ComputeIntersection<
55
55
  {
56
56
  _aaa_str: string;
57
57
  aaa_str: "a" | "b";
58
58
  aaa_num: number;
59
59
  aaa_obj: Mock_User | null;
60
- } & IInjectData
60
+ } & IInjectAllData
61
61
  >,
62
62
  Test.Pass
63
63
  >;
@@ -72,7 +72,7 @@ SubComponent<{ data: { _num: number } }, CompDoc>()({
72
72
  },
73
73
  lifetimes: {
74
74
  attached() {
75
- Checking<typeof this.data.aaa_obj, ReadonlyDeep<Mock_User | null>, Test.Pass>;
75
+ Checking<typeof this.data.aaa_obj, Mock_User | null, Test.Pass>;
76
76
 
77
77
  this.setData({
78
78
  aaa_obj: {} as Mock_User, // aaa_obj 类型为 Mock_User | null 而非 null
@@ -1,8 +1,8 @@
1
1
  import { Checking, type Test } from "hry-types";
2
- import type { ReadonlyDeep } from "hry-types/src/Any/_api";
3
2
  import type { ComponentDoc } from "../../../DefineComponent/ReturnType/ComponentDoc";
4
3
 
5
- import type { IInjectData } from "../../../InstanceInject/instanceConfig";
4
+ import type { ComputeIntersection } from "hry-types/src/Object/ComputeIntersection";
5
+ import type { IInjectAllData } from "../../../InstanceInject/instanceConfig";
6
6
  import type { Mock_User } from "../../../RootComponent/Properties/test/normalRequired.test";
7
7
  import type { RootComponentDoc } from "../../../RootComponent/RootComponentDoc";
8
8
  import { SubComponent } from "../..";
@@ -55,7 +55,7 @@ SubComponent<RootDoc, CompDoc>()({
55
55
  // this.data
56
56
  Checking<
57
57
  typeof this.data,
58
- ReadonlyDeep<
58
+ ComputeIntersection<
59
59
  {
60
60
  // RootData
61
61
  Pstr: string;
@@ -65,7 +65,7 @@ SubComponent<RootDoc, CompDoc>()({
65
65
  Cnum: number;
66
66
  // 自身Data类型与CompDoc类型相同
67
67
  aaa_str: string;
68
- } & IInjectData
68
+ } & IInjectAllData
69
69
  >,
70
70
  Test.Pass
71
71
  >;
@@ -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,12 +0,0 @@
1
- import type { Func } from "hry-types/src/Misc/Func";
2
- import type { FinalOptionsOfComponent } from "..";
3
- import type { ComputedDependence } from "./computedUpdater";
4
- type ItemCache = {
5
- dependences: ComputedDependence[];
6
- method: Func;
7
- value: unknown;
8
- };
9
- export type ComputedCache = Record<string, ItemCache>;
10
- export declare function getItemCache(initAllData: object, computedKeys: string[], computedFunc: Func): false | ItemCache;
11
- export declare function initComputed(options: FinalOptionsOfComponent, computedConfig: Record<string, Func>, initAllData: object, uninitedkeys?: string[], computedCache?: ComputedCache): ComputedCache;
12
- export {};
@@ -1 +0,0 @@
1
- {"version":3,"file":"initComputed.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/assignOptions/computedWatchHandle/initComputed.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAExD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAa1C,SAAS,kBAAkB,CAAC,WAAiC,EAAE,YAAsB;IACnF,KAAK,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG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AC;QAC9B,OAAO,aAAa,CAAC;IACvB,CAAC;IAGD,OAAO,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,CAAC,CAAC;AACzF,CAAC"}
@@ -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
- });