annil 1.13.1 → 1.13.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 +7 -0
- package/dist/api/CustomComponent/returnType.d.ts +1 -2
- package/dist/utils/typeEqual.d.ts +2 -1
- package/dist/utils/typeEqual.js +2 -2
- package/dist/utils/typeEqual.js.map +1 -1
- package/package.json +1 -1
- package/src/api/CustomComponent/returnType.ts +1 -14
- package/src/api/DefineComponent/SubComponents/test/normal.test.ts +1 -1
- package/src/thirdLib/wm/swiper.test.ts +2 -2
- package/src/utils/typeEqual.ts +15 -4
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.13.2](https://github.com/missannil/annil/compare/v1.13.1...v1.13.2) (2026-06-05)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* typeEqual 和_CustomComponentDefinition ([9914cc5](https://github.com/missannil/annil/commit/9914cc59d063a1dce2427b33fd27c18d233636d1))
|
|
13
|
+
|
|
7
14
|
## [1.13.1](https://github.com/missannil/annil/compare/v1.13.0...v1.13.1) (2026-03-26)
|
|
8
15
|
|
|
9
16
|
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Func } from "hry-types/src/Misc/Func";
|
|
2
2
|
import type { ComputedConstraint } from "../RootComponent/Computed/ComputedConstraint";
|
|
3
|
-
import type { CustomEventsTags } from "../RootComponent/CustomEvents/CustomEventsTag";
|
|
4
3
|
import type { DataConstraint } from "../RootComponent/Data/DataConstraint";
|
|
5
4
|
import type { EventsConstraint } from "../RootComponent/Events/EventsConstraint";
|
|
6
5
|
import type { LifetimesConstraint } from "../RootComponent/Lifetimes/LifetimesConstraint";
|
|
@@ -8,7 +7,7 @@ import type { MethodsConstraint } from "../RootComponent/Methods/MethodsConstrai
|
|
|
8
7
|
import type { PageLifetimesOption } from "../RootComponent/PageLifetimes/PageLifetimesOption";
|
|
9
8
|
import type { StoreConstraint } from "../RootComponent/Store/StoreConstraint";
|
|
10
9
|
type _CustomComponentDefinition = {
|
|
11
|
-
composedEvents?: Record<string,
|
|
10
|
+
composedEvents?: Record<string, unknown>;
|
|
12
11
|
};
|
|
13
12
|
type _Validator<O, Doc, ErrKeys = Exclude<keyof O, keyof Doc>> = [ErrKeys] extends [never] ? Doc : `错误的字段${ErrKeys & string}`;
|
|
14
13
|
export type CustomComponentDefinition<O extends _Validator<O, _CustomComponentDefinition> = _CustomComponentDefinition> = O;
|
|
@@ -1,2 +1,3 @@
|
|
|
1
1
|
import type { Equals } from "hry-types/src/Any/Equals";
|
|
2
|
-
export declare function typeEqual<const A
|
|
2
|
+
export declare function typeEqual<const A>(): <B>(b: B & (Equals<A, B> extends true ? unknown : never)) => void;
|
|
3
|
+
export declare function typeEqual<const A, const B extends Equals<A, B> extends true ? unknown : never>(): () => void;
|
package/dist/utils/typeEqual.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"typeEqual.js","sourceRoot":"","sources":["../../src/utils/typeEqual.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"typeEqual.js","sourceRoot":"","sources":["../../src/utils/typeEqual.ts"],"names":[],"mappings":"AAwBA,MAAM,UAAU,SAAS;IAIvB,OAAO,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { Func } from "hry-types/src/Misc/Func";
|
|
2
2
|
import type { ComputedConstraint } from "../RootComponent/Computed/ComputedConstraint";
|
|
3
|
-
import type { CustomEventsTags } from "../RootComponent/CustomEvents/CustomEventsTag";
|
|
4
3
|
import type { DataConstraint } from "../RootComponent/Data/DataConstraint";
|
|
5
4
|
import type { EventsConstraint } from "../RootComponent/Events/EventsConstraint";
|
|
6
5
|
import type { LifetimesConstraint } from "../RootComponent/Lifetimes/LifetimesConstraint";
|
|
@@ -9,19 +8,7 @@ import type { PageLifetimesOption } from "../RootComponent/PageLifetimes/PageLif
|
|
|
9
8
|
import type { StoreConstraint } from "../RootComponent/Store/StoreConstraint";
|
|
10
9
|
|
|
11
10
|
type _CustomComponentDefinition = {
|
|
12
|
-
composedEvents?: Record<
|
|
13
|
-
string,
|
|
14
|
-
| string
|
|
15
|
-
| number
|
|
16
|
-
| bigint
|
|
17
|
-
| boolean
|
|
18
|
-
| symbol
|
|
19
|
-
| null
|
|
20
|
-
| undefined
|
|
21
|
-
| Record<string, unknown>
|
|
22
|
-
| unknown[]
|
|
23
|
-
| CustomEventsTags
|
|
24
|
-
>;
|
|
11
|
+
composedEvents?: Record<string, unknown>;
|
|
25
12
|
};
|
|
26
13
|
|
|
27
14
|
// 验证key是否合法
|
|
@@ -12,11 +12,11 @@ CustomComponent<{}, Wm.Swiper>()({
|
|
|
12
12
|
},
|
|
13
13
|
events: {
|
|
14
14
|
swiper_change(e) {
|
|
15
|
-
typeEqual<number>(e.detail.current);
|
|
15
|
+
typeEqual<number>()(e.detail.current);
|
|
16
16
|
},
|
|
17
17
|
|
|
18
18
|
swiper_animationfinish(e) {
|
|
19
|
-
typeEqual<number>(e.detail.current);
|
|
19
|
+
typeEqual<number>()(e.detail.current);
|
|
20
20
|
},
|
|
21
21
|
},
|
|
22
22
|
});
|
package/src/utils/typeEqual.ts
CHANGED
|
@@ -7,13 +7,24 @@ import type { Equals } from "hry-types/src/Any/Equals";
|
|
|
7
7
|
* type A = typeof a;
|
|
8
8
|
* const b = 2;
|
|
9
9
|
* type B = typeof b;
|
|
10
|
-
*
|
|
11
|
-
* typeEqual<A>(
|
|
10
|
+
* type C = 1;
|
|
11
|
+
* typeEqual<A, C>(); // 不报错
|
|
12
|
+
* typeEqual<A>()(a); // 不报错
|
|
13
|
+
* typeEqual<A, B>(); // B位置报错 - 类型“2”不满足约束“never”
|
|
14
|
+
* typeEqual<A>()(b); // b位置报错 - 类型“2”的参数不能赋给类型“never”的参数。
|
|
12
15
|
* ```
|
|
13
16
|
*/
|
|
17
|
+
export function typeEqual<
|
|
18
|
+
const A,
|
|
19
|
+
>(): <B>(b: B & (Equals<A, B> extends true ? unknown : never)) => void;
|
|
20
|
+
export function typeEqual<
|
|
21
|
+
const A,
|
|
22
|
+
const B extends Equals<A, B> extends true ? unknown : never,
|
|
23
|
+
>(): () => void;
|
|
24
|
+
|
|
14
25
|
export function typeEqual<
|
|
15
26
|
const A,
|
|
16
27
|
const B extends Equals<A, B> extends true ? unknown : never = never,
|
|
17
|
-
>(
|
|
18
|
-
void
|
|
28
|
+
>(): (b?: B) => void {
|
|
29
|
+
return () => void 0;
|
|
19
30
|
}
|