annil 1.13.0 → 1.13.1
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 +9 -0
- package/dist/api/ChunkComponent/index.d.ts +3 -3
- package/dist/api/CustomComponent/CustomReturnType/CreateCustomComponentDoc.d.ts +1 -1
- package/dist/api/CustomComponent/index.d.ts +2 -2
- package/dist/api/RootComponent/Computed/{GetComputedDoc.d.ts → GetComputedDef.d.ts} +1 -1
- package/dist/api/RootComponent/Computed/GetComputedDef.js +2 -0
- package/dist/api/RootComponent/Computed/GetComputedDef.js.map +1 -0
- package/dist/api/RootComponent/CustomEvents/CustomEventConstraint.d.ts +10 -5
- package/dist/api/RootComponent/CustomEvents/CustomEventsTag.d.ts +2 -2
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDef.d.ts +10 -0
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDef.js +2 -0
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDef.js.map +1 -0
- package/dist/api/RootComponent/Events/EventsConstraint.d.ts +2 -2
- package/dist/api/RootComponent/Instance/CustomEventMethods.d.ts +2 -2
- package/dist/api/RootComponent/Instance/RootComponentInstance.d.ts +4 -4
- package/dist/api/RootComponent/PageLifetimes/PageLifetimesOption.d.ts +1 -1
- package/dist/api/RootComponent/Properties/{GetOptionalDoc.d.ts → GetOptionalDef.d.ts} +1 -1
- package/dist/api/RootComponent/Properties/GetOptionalDef.js +2 -0
- package/dist/api/RootComponent/Properties/GetOptionalDef.js.map +1 -0
- package/dist/api/RootComponent/Properties/GetPropertiesDef.d.ts +8 -0
- package/dist/api/RootComponent/Properties/GetPropertiesDef.js +2 -0
- package/dist/api/RootComponent/Properties/GetPropertiesDef.js.map +1 -0
- package/dist/api/RootComponent/Properties/GetRequiredDef.d.ts +5 -0
- package/dist/api/RootComponent/Properties/GetRequiredDef.js +2 -0
- package/dist/api/RootComponent/Properties/GetRequiredDef.js.map +1 -0
- package/dist/api/RootComponent/Store/{GeTStoreDoc.d.ts → GetStoreDef.d.ts} +1 -1
- package/dist/api/RootComponent/Store/GetStoreDef.js +3 -0
- package/dist/api/RootComponent/Store/GetStoreDef.js.map +1 -0
- package/dist/api/RootComponent/index.d.ts +19 -19
- package/dist/api/wxSugar.d.ts +1 -1
- package/dist/index.d.ts +1 -2
- package/dist/index.js.map +1 -1
- package/dist/types/ComputeObject.js +2 -0
- package/dist/types/ComputeObject.js.map +1 -0
- package/dist/utils/typeEqual.d.ts +1 -1
- package/dist/utils/typeEqual.js +2 -2
- package/dist/utils/typeEqual.js.map +1 -1
- package/package.json +1 -1
- package/src/api/ChunkComponent/ChunkComputed/test/normal.test.ts +1 -1
- package/src/api/ChunkComponent/index.ts +4 -4
- package/src/api/CustomComponent/CustomReturnType/CreateCustomComponentDoc.ts +1 -1
- package/src/api/CustomComponent/index.ts +2 -2
- package/src/api/DefineComponent/SubComponents/test/normal.test.ts +4 -4
- package/src/api/DefineComponent/index.ts +4 -4
- package/src/api/DefineComponent/returnType/test/normalPageDoc.test.ts +0 -1
- package/src/api/RootComponent/Computed/ComputedOption.ts +2 -3
- package/src/api/RootComponent/Computed/{GetComputedDoc.ts → GetComputedDef.ts} +1 -1
- package/src/api/RootComponent/Computed/test/GetComputedDoc.test.ts +3 -3
- package/src/api/RootComponent/CustomEvents/CustomEventConstraint.ts +20 -5
- package/src/api/RootComponent/CustomEvents/CustomEventsDef.ts +4 -0
- package/src/api/RootComponent/CustomEvents/CustomEventsTag.ts +2 -2
- package/src/api/RootComponent/CustomEvents/GetCustomEventDef.ts +29 -0
- package/src/api/RootComponent/CustomEvents/GetCustomEventDoc.ts +3 -3
- package/src/api/RootComponent/CustomEvents/test/GetCustomEventDoc.test.ts +2 -2
- package/src/api/RootComponent/CustomEvents/test/GetShortEventDoc.test.ts +6 -6
- package/src/api/RootComponent/CustomEvents/test/normal.test.ts +8 -8
- package/src/api/RootComponent/Data/GetDataDef.ts +8 -0
- package/src/api/RootComponent/Data/test/GetDataDoc.test.ts +3 -3
- package/src/api/RootComponent/Events/EventsConstraint.ts +3 -3
- package/src/api/RootComponent/Events/test/normal.test.ts +16 -0
- package/src/api/RootComponent/Instance/CustomEventMethods.ts +4 -4
- package/src/api/RootComponent/Instance/RootComponentInstance.ts +4 -4
- package/src/api/RootComponent/PageLifetimes/PageLifetimesOption.ts +1 -1
- package/src/api/RootComponent/Properties/{GetOptionalDoc.ts → GetOptionalDef.ts} +1 -1
- package/src/api/RootComponent/Properties/GetPropertiesDef.ts +25 -0
- package/src/api/RootComponent/Properties/GetRequiredDef.ts +16 -0
- package/src/api/RootComponent/Store/{GeTStoreDoc.ts → GetStoreDef.ts} +10 -14
- package/src/api/RootComponent/index.ts +50 -50
- package/src/api/wxSugar.ts +1 -1
- package/src/index.ts +1 -2
- package/src/thirdLib/wm/swiper.test.ts +4 -6
- package/src/utils/typeEqual.ts +11 -8
- package/src/utils/typeNotEqual.ts +48 -0
- package/dist/api/RootComponent/Computed/GetComputedDoc.js +0 -2
- package/dist/api/RootComponent/Computed/GetComputedDoc.js.map +0 -1
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.d.ts +0 -10
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.js +0 -2
- package/dist/api/RootComponent/CustomEvents/GetCustomEventDoc.js.map +0 -1
- package/dist/api/RootComponent/Properties/GetOptionalDoc.js +0 -2
- package/dist/api/RootComponent/Properties/GetOptionalDoc.js.map +0 -1
- package/dist/api/RootComponent/Properties/GetPropertiesDoc.d.ts +0 -8
- package/dist/api/RootComponent/Properties/GetPropertiesDoc.js +0 -2
- package/dist/api/RootComponent/Properties/GetPropertiesDoc.js.map +0 -1
- package/dist/api/RootComponent/Properties/GetRequiredDoc.d.ts +0 -6
- package/dist/api/RootComponent/Properties/GetRequiredDoc.js +0 -2
- package/dist/api/RootComponent/Properties/GetRequiredDoc.js.map +0 -1
- package/dist/api/RootComponent/Store/GeTStoreDoc.js +0 -2
- package/dist/api/RootComponent/Store/GeTStoreDoc.js.map +0 -1
- package/dist/types/ComputeObj.js +0 -2
- package/dist/types/ComputeObj.js.map +0 -1
- package/dist/types/TwoParamsEqual.d.ts +0 -2
- package/dist/types/TwoParamsEqual.js +0 -2
- package/dist/types/TwoParamsEqual.js.map +0 -1
- package/src/api/RootComponent/Properties/GetPropertiesDoc.ts +0 -24
- package/src/api/RootComponent/Properties/GetRequiredDoc.ts +0 -23
- /package/dist/types/{ComputeObj.d.ts → ComputeObject.d.ts} +0 -0
- /package/src/types/{ComputeObj.ts → ComputeObject.ts} +0 -0
|
@@ -2,17 +2,17 @@ import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
|
2
2
|
import type { EmptyObject } from "hry-types/src/Misc/EmptyObject";
|
|
3
3
|
import type { Func } from "hry-types/src/Misc/Func";
|
|
4
4
|
import type { ComputeIntersection } from "hry-types/src/Object/_api";
|
|
5
|
-
import type { ComputeObject } from "../../types/
|
|
5
|
+
import type { ComputeObject } from "../../types/ComputeObject";
|
|
6
6
|
import type { WMCompOtherOption } from "../../types/OfficialTypeAlias";
|
|
7
7
|
import type { RemoveNullOfRequired } from "../../types/RemoveNullOfRequired";
|
|
8
8
|
import type { ComponentDoc } from "../DefineComponent/returnType/ComponentDoc";
|
|
9
9
|
import type { IInjectStore } from "../InstanceInject/instanceConfig";
|
|
10
10
|
import type { ComputedConstraint } from "./Computed/ComputedConstraint";
|
|
11
11
|
import type { ComputedOption } from "./Computed/ComputedOption";
|
|
12
|
-
import type {
|
|
12
|
+
import type { GetComputedDef } from "./Computed/GetComputedDef";
|
|
13
13
|
import type { CustomEventConstraint } from "./CustomEvents/CustomEventConstraint";
|
|
14
14
|
import type { CustomEventsOption } from "./CustomEvents/CustomEventsOption";
|
|
15
|
-
import type {
|
|
15
|
+
import type { GetCustomEventsDef } from "./CustomEvents/GetCustomEventDef";
|
|
16
16
|
import type { DataOption } from "./Data/DataOption";
|
|
17
17
|
import type { EventsConstraint } from "./Events/EventsConstraint";
|
|
18
18
|
import type { EventsOption } from "./Events/EventsOption";
|
|
@@ -23,10 +23,10 @@ import type { MethodsConstraint } from "./Methods/MethodsConstraint";
|
|
|
23
23
|
import type { MethodsOption } from "./Methods/MethodsOption";
|
|
24
24
|
import type { ObserversOption } from "./Observers/ObserversOption";
|
|
25
25
|
import type { PageLifetimesOption } from "./PageLifetimes/PageLifetimesOption";
|
|
26
|
-
import type {
|
|
26
|
+
import type { GetPropertiesDef } from "./Properties/GetPropertiesDef";
|
|
27
27
|
import type { PropertiesConstraint } from "./Properties/PropertiesConstraint";
|
|
28
28
|
import type { PropertiesOption } from "./Properties/PropertiesOption";
|
|
29
|
-
import type {
|
|
29
|
+
import type { GetStoreDef } from "./Store/GetStoreDef";
|
|
30
30
|
import type { StoreConstraint } from "./Store/StoreConstraint";
|
|
31
31
|
import type { StoreOption } from "./Store/StoreOption";
|
|
32
32
|
import type { WatchOption } from "./Watch/WatchOption";
|
|
@@ -40,55 +40,55 @@ type RootComponentOptions<
|
|
|
40
40
|
TData extends object,
|
|
41
41
|
TStore extends StoreConstraint,
|
|
42
42
|
TComputed extends Record<string, Func>,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
43
|
+
EventsDef extends object,
|
|
44
|
+
CustomEventsDef extends object,
|
|
45
|
+
PropertiesDef extends object,
|
|
46
|
+
DataDef extends object,
|
|
47
|
+
StoreDef extends object,
|
|
48
|
+
ComputedDef extends object,
|
|
49
49
|
> =
|
|
50
|
-
& MethodsOption<TMethods, keyof (
|
|
50
|
+
& MethodsOption<TMethods, keyof (EventsDef & CustomEventsDef)>
|
|
51
51
|
& PropertiesOption<TProperties>
|
|
52
52
|
& IsPageOption<TIsPage>
|
|
53
53
|
& EventsOption<TEvents>
|
|
54
|
-
& CustomEventsOption<TCustomEvents, keyof
|
|
55
|
-
& DataOption<TData, keyof
|
|
56
|
-
& StoreOption<TStore, keyof (
|
|
54
|
+
& IfExtends<TIsPage, false, CustomEventsOption<TCustomEvents, keyof EventsDef>, {}>
|
|
55
|
+
& DataOption<TData, keyof PropertiesDef>
|
|
56
|
+
& StoreOption<TStore, keyof (PropertiesDef & DataDef)>
|
|
57
57
|
& ComputedOption<
|
|
58
58
|
TComputed,
|
|
59
|
-
keyof (
|
|
60
|
-
> // { data: ComputeObject<
|
|
61
|
-
& PageLifetimesOption<TIsPage,
|
|
59
|
+
keyof (PropertiesDef & DataDef & StoreDef)
|
|
60
|
+
> // { data: ComputeObject<DataDef & Required<PropertiesDef> & StoreDef & ComputedDef & IInjectAllData> }
|
|
61
|
+
& PageLifetimesOption<TIsPage, PropertiesDef>
|
|
62
62
|
& LifetimesOption
|
|
63
63
|
& WatchOption<
|
|
64
|
-
&
|
|
65
|
-
& Required<
|
|
66
|
-
&
|
|
67
|
-
&
|
|
64
|
+
& ComputedDef
|
|
65
|
+
& Required<PropertiesDef>
|
|
66
|
+
& DataDef
|
|
67
|
+
& StoreDef
|
|
68
68
|
& IInjectStore
|
|
69
69
|
>
|
|
70
70
|
& Partial<Omit<WMCompOtherOption, "pageLifetimes" | "definitionFilter" | "observers">>
|
|
71
71
|
& ObserversOption<
|
|
72
|
-
&
|
|
73
|
-
& Required<
|
|
74
|
-
&
|
|
75
|
-
&
|
|
72
|
+
& ComputedDef
|
|
73
|
+
& Required<PropertiesDef>
|
|
74
|
+
& DataDef
|
|
75
|
+
& StoreDef
|
|
76
76
|
& IInjectStore
|
|
77
77
|
>
|
|
78
78
|
& ThisType<
|
|
79
79
|
RootComponentInstance<
|
|
80
80
|
TIsPage,
|
|
81
81
|
TMethods,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
DataDef,
|
|
83
|
+
DataDef & Required<PropertiesDef> & StoreDef & ComputedDef,
|
|
84
|
+
CustomEventsDef,
|
|
85
|
+
StoreDef
|
|
86
86
|
>
|
|
87
87
|
>;
|
|
88
88
|
|
|
89
89
|
type RootComponentConstructor<TComponentDocList extends ComponentDoc[]> = <
|
|
90
90
|
TEvents extends EventsConstraint<TComponentDocList>,
|
|
91
|
-
TStore extends StoreConstraint<
|
|
91
|
+
TStore extends StoreConstraint<PropertiesDef>,
|
|
92
92
|
TIsPage extends boolean = false,
|
|
93
93
|
const TProperties extends PropertiesConstraint = {},
|
|
94
94
|
TData extends object = {},
|
|
@@ -96,12 +96,12 @@ type RootComponentConstructor<TComponentDocList extends ComponentDoc[]> = <
|
|
|
96
96
|
// 页面时自定义事件无意义
|
|
97
97
|
TCustomEvents extends IfExtends<TIsPage, false, CustomEventConstraint, EmptyObject> = {},
|
|
98
98
|
TMethods extends MethodsConstraint = {},
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
99
|
+
EventsDef extends object = IfExtends<EventsConstraint<TComponentDocList>, TEvents, {}, TEvents>,
|
|
100
|
+
CustomEventsDef extends object = GetCustomEventsDef<TCustomEvents>,
|
|
101
|
+
PropertiesDef extends object = GetPropertiesDef<TProperties>,
|
|
102
|
+
DataDef extends object = TData,
|
|
103
|
+
StoreDef extends object = StoreConstraint<PropertiesDef> extends TStore ? {} : GetStoreDef<TStore>,
|
|
104
|
+
ComputedDef extends object = GetComputedDef<TComputed>,
|
|
105
105
|
>(
|
|
106
106
|
options: RootComponentOptions<
|
|
107
107
|
TEvents,
|
|
@@ -113,28 +113,28 @@ type RootComponentConstructor<TComponentDocList extends ComponentDoc[]> = <
|
|
|
113
113
|
TStore,
|
|
114
114
|
TComputed,
|
|
115
115
|
// TObservers,
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
116
|
+
EventsDef,
|
|
117
|
+
CustomEventsDef,
|
|
118
|
+
PropertiesDef,
|
|
119
|
+
DataDef,
|
|
120
|
+
StoreDef,
|
|
121
|
+
ComputedDef
|
|
122
122
|
>,
|
|
123
123
|
) => // 生成RootComponentDefinition
|
|
124
124
|
ComputeIntersection<
|
|
125
125
|
& IfExtends<TIsPage, false, {}, { isPage: true }>
|
|
126
126
|
& IfExtends<
|
|
127
127
|
EmptyObject,
|
|
128
|
-
|
|
128
|
+
PropertiesDef,
|
|
129
129
|
{},
|
|
130
|
-
{ properties: IfExtends<false, TIsPage,
|
|
130
|
+
{ properties: IfExtends<false, TIsPage, PropertiesDef, RemoveNullOfRequired<PropertiesDef>> }
|
|
131
131
|
>
|
|
132
|
-
& IfExtends<EmptyObject,
|
|
133
|
-
& IfExtends<EmptyObject,
|
|
134
|
-
& IfExtends<EmptyObject,
|
|
132
|
+
& IfExtends<EmptyObject, DataDef, {}, { data: DataDef }>
|
|
133
|
+
& IfExtends<EmptyObject, StoreDef, {}, { store: ComputeObject<StoreDef> }>
|
|
134
|
+
& IfExtends<EmptyObject, ComputedDef, {}, { computed: ComputedDef }>
|
|
135
135
|
& IfExtends<EmptyObject, TMethods, {}, { methods: TMethods }>
|
|
136
|
-
& IfExtends<EmptyObject,
|
|
137
|
-
& IfExtends<EmptyObject,
|
|
136
|
+
& IfExtends<EmptyObject, EventsDef, {}, { events: EventsDef }>
|
|
137
|
+
& IfExtends<EmptyObject, CustomEventsDef, {}, { customEvents: ComputeObject<CustomEventsDef> }>
|
|
138
138
|
>;
|
|
139
139
|
/**
|
|
140
140
|
* RootComponent API
|
package/src/api/wxSugar.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { IfEquals } from "hry-types/src/Any/IfEquals";
|
|
2
2
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
3
3
|
import type { NoInfer } from "hry-types/src/Generic/NoInfer";
|
|
4
|
-
import type { ComputeObject } from "../types/
|
|
4
|
+
import type { ComputeObject } from "../types/ComputeObject";
|
|
5
5
|
import type { WMNavigateToOption } from "../types/OfficialTypeAlias";
|
|
6
6
|
import type { RequiredKeys } from "../types/RequiredKeys";
|
|
7
7
|
import { INNERMARKER } from "../utils/InnerMarker";
|
package/src/index.ts
CHANGED
|
@@ -7,7 +7,7 @@ import { navigateBack, navigateTo, redirectTo } from "./api/wxSugar";
|
|
|
7
7
|
import type { CreateComponentType } from "./types/CreateComponentType";
|
|
8
8
|
import type { DetailedType } from "./types/DetailedType";
|
|
9
9
|
import type { ExtendComponentType } from "./types/ExtendComponentType";
|
|
10
|
-
|
|
10
|
+
|
|
11
11
|
export * from "./utils/_utils";
|
|
12
12
|
|
|
13
13
|
export type {
|
|
@@ -43,7 +43,6 @@ export {
|
|
|
43
43
|
instanceConfig,
|
|
44
44
|
navigateBack,
|
|
45
45
|
navigateTo,
|
|
46
|
-
type ParamsEqual,
|
|
47
46
|
redirectTo,
|
|
48
47
|
RootComponent,
|
|
49
48
|
};
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { CustomComponent, typeEqual } from "../../index";
|
|
2
2
|
import type { Wm } from "../index";
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
const swiper = CustomComponent<{}, Wm.Swiper>()({
|
|
4
|
+
CustomComponent<{}, Wm.Swiper>()({
|
|
6
5
|
data: {
|
|
7
6
|
swiper_style: "16/9",
|
|
8
7
|
},
|
|
@@ -12,13 +11,12 @@ const swiper = CustomComponent<{}, Wm.Swiper>()({
|
|
|
12
11
|
},
|
|
13
12
|
},
|
|
14
13
|
events: {
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
14
|
swiper_change(e) {
|
|
17
|
-
typeEqual<
|
|
15
|
+
typeEqual<number>(e.detail.current);
|
|
18
16
|
},
|
|
19
|
-
|
|
17
|
+
|
|
20
18
|
swiper_animationfinish(e) {
|
|
21
|
-
typeEqual<
|
|
19
|
+
typeEqual<number>(e.detail.current);
|
|
22
20
|
},
|
|
23
21
|
},
|
|
24
22
|
});
|
package/src/utils/typeEqual.ts
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import type { Equals } from "hry-types/src/Any/Equals";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
|
-
*
|
|
3
|
+
* 类型相等验证
|
|
5
4
|
* @example
|
|
6
5
|
* ```ts
|
|
7
|
-
*
|
|
8
|
-
*
|
|
6
|
+
* const a = 1;
|
|
7
|
+
* type A = typeof a;
|
|
8
|
+
* const b = 2;
|
|
9
|
+
* type B = typeof b;
|
|
10
|
+
* typeEqual<A, B>(); // B位置报错
|
|
11
|
+
* typeEqual<A>(a); // 不报错
|
|
9
12
|
* ```
|
|
10
13
|
*/
|
|
11
14
|
export function typeEqual<
|
|
12
|
-
A,
|
|
13
|
-
B extends Equals<A, B> extends true ? unknown : never,
|
|
14
|
-
>() {
|
|
15
|
-
void
|
|
15
|
+
const A,
|
|
16
|
+
const B extends Equals<A, B> extends true ? unknown : never = never,
|
|
17
|
+
>(a?: NoInfer<A>): void {
|
|
18
|
+
void a;
|
|
16
19
|
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { Equals } from "hry-types/src/Any/Equals";
|
|
2
|
+
export type InqualityCall<A> = <const B>(b: B, ...nullable: Equals<A, B> extends false ? [] : [never]) => void;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 类型和变量不等验证
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* const a = { a: 1 } as const;
|
|
9
|
+
* type B = { a: number };
|
|
10
|
+
* typeNotEqual<B>()(a); 不报错
|
|
11
|
+
* ```
|
|
12
|
+
*/
|
|
13
|
+
export function typeNotEqual<
|
|
14
|
+
const A,
|
|
15
|
+
>(): InqualityCall<A>;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* 二个类型不等验证
|
|
19
|
+
* @example
|
|
20
|
+
* ```ts
|
|
21
|
+
* const a = 1;
|
|
22
|
+
* type A = typeof a;
|
|
23
|
+
* const b = 2;
|
|
24
|
+
* type B = typeof b;
|
|
25
|
+
* typeNotEqual<A, B>(); 不报错
|
|
26
|
+
*/
|
|
27
|
+
export function typeNotEqual<
|
|
28
|
+
const A,
|
|
29
|
+
const B extends Equals<A, B> extends false ? unknown : never = never,
|
|
30
|
+
>(): void;
|
|
31
|
+
/**
|
|
32
|
+
* 类型不等验证
|
|
33
|
+
* @example
|
|
34
|
+
* ```ts
|
|
35
|
+
* const a = 1;
|
|
36
|
+
* type A = typeof a;
|
|
37
|
+
* const b = 2;
|
|
38
|
+
* type B = typeof b;
|
|
39
|
+
* typeNotEqual<A, B>(); // 不报错
|
|
40
|
+
* typeNotEqual<A>()(b); // 不报错
|
|
41
|
+
* typeNotEqual<A>()(a); // 报错
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export function typeNotEqual<
|
|
45
|
+
const A,
|
|
46
|
+
>(): void | InqualityCall<A> {
|
|
47
|
+
void 0;
|
|
48
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GetComputedDoc.js","sourceRoot":"","sources":["../../../../src/api/RootComponent/Computed/GetComputedDoc.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
|
-
import type { DetailedType } from "../../../types/DetailedType";
|
|
3
|
-
import type { InferDetailedType } from "../../../types/InferDetailedType";
|
|
4
|
-
import type { CustomEventConstraint, FullCustomEvents, ShortCustomeEvents, SimpleCustomeEventsList } from "./CustomEventConstraint";
|
|
5
|
-
import type { AddTagForCustomEventsDoc } from "./CustomEventsTag";
|
|
6
|
-
export type GetShortCustomEventsDoc<T extends ShortCustomeEvents> = T extends DetailedType ? InferDetailedType<T> : T extends null ? null : T extends undefined ? undefined : T extends SimpleCustomeEventsList ? GetShortCustomEventsDoc<T[number]> : never;
|
|
7
|
-
export type GetFullCustomEventsDoc<T extends FullCustomEvents> = GetShortCustomEventsDoc<T["detail"]> | IfExtends<unknown, T["options"], never, AddTagForCustomEventsDoc<T["options"] & {}>>;
|
|
8
|
-
export type GetCustomEventDoc<T extends CustomEventConstraint> = {
|
|
9
|
-
[k in keyof T]: T[k] extends ShortCustomeEvents ? GetShortCustomEventsDoc<T[k]> : GetShortCustomEventsDoc<T[k]["detail"]> | IfExtends<unknown, T[k]["options"], never, AddTagForCustomEventsDoc<T[k]["options"] & {}>>;
|
|
10
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GetCustomEventDoc.js","sourceRoot":"","sources":["../../../../src/api/RootComponent/CustomEvents/GetCustomEventDoc.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GetOptionalDoc.js","sourceRoot":"","sources":["../../../../src/api/RootComponent/Properties/GetOptionalDoc.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Select } from "hry-types/src/Object/Select";
|
|
2
|
-
import type { ComputeIntersection } from "hry-types/src/Object/_api";
|
|
3
|
-
import type { GetOptionalDoc } from "./GetOptionalDoc";
|
|
4
|
-
import type { GetRequiredDoc } from "./GetRequiredDoc";
|
|
5
|
-
import type { OptionalType, PropertiesConstraint } from "./PropertiesConstraint";
|
|
6
|
-
type _GetPropertiesDoc<TProperties extends PropertiesConstraint, OptionalDoc extends object = GetOptionalDoc<Select<TProperties, OptionalType>>, RequiredDoc extends object = GetRequiredDoc<Omit<TProperties, keyof OptionalDoc>>> = ComputeIntersection<OptionalDoc & RequiredDoc>;
|
|
7
|
-
export type GetPropertiesDoc<TProperties extends PropertiesConstraint> = _GetPropertiesDoc<TProperties>;
|
|
8
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GetPropertiesDoc.js","sourceRoot":"","sources":["../../../../src/api/RootComponent/Properties/GetPropertiesDoc.ts"],"names":[],"mappings":""}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
|
-
import type { InferDetailedType } from "../../../types/InferDetailedType";
|
|
3
|
-
import type { RequiredSingle, RequiredType } from "./PropertiesConstraint";
|
|
4
|
-
export type GetRequiredDoc<TProperties extends Record<string, RequiredType>> = {
|
|
5
|
-
-readonly [k in keyof TProperties]: IfExtends<TProperties[k], RequiredSingle, InferDetailedType<TProperties[k]>, InferDetailedType<TProperties[k]["type"]> | InferDetailedType<TProperties[k]["optionalTypes"][number]>>;
|
|
6
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GetRequiredDoc.js","sourceRoot":"","sources":["../../../../src/api/RootComponent/Properties/GetRequiredDoc.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GeTStoreDoc.js","sourceRoot":"","sources":["../../../../src/api/RootComponent/Store/GeTStoreDoc.ts"],"names":[],"mappings":""}
|
package/dist/types/ComputeObj.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ComputeObj.js","sourceRoot":"","sources":["../../src/types/ComputeObj.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TwoParamsEqual.js","sourceRoot":"","sources":["../../src/types/TwoParamsEqual.ts"],"names":[],"mappings":""}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import type { Select } from "hry-types/src/Object/Select";
|
|
2
|
-
|
|
3
|
-
import type { ComputeIntersection } from "hry-types/src/Object/_api";
|
|
4
|
-
import type { GetOptionalDoc } from "./GetOptionalDoc";
|
|
5
|
-
import type { GetRequiredDoc } from "./GetRequiredDoc";
|
|
6
|
-
import type { OptionalType, PropertiesConstraint } from "./PropertiesConstraint";
|
|
7
|
-
|
|
8
|
-
type _GetPropertiesDoc<
|
|
9
|
-
TProperties extends PropertiesConstraint,
|
|
10
|
-
// TIsPage extends boolean,
|
|
11
|
-
// @ts-ignore
|
|
12
|
-
OptionalDoc extends object = GetOptionalDoc<Select<TProperties, OptionalType>>,
|
|
13
|
-
// @ts-ignore
|
|
14
|
-
RequiredDoc extends object = GetRequiredDoc<Omit<TProperties, keyof OptionalDoc>>,
|
|
15
|
-
> = ComputeIntersection<OptionalDoc & RequiredDoc>;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* properties字段的文档类型
|
|
19
|
-
* @remarks 必传的字段如果是object,要联合上null类型,选传的object根据是否是页面来决定是否加null
|
|
20
|
-
*/
|
|
21
|
-
export type GetPropertiesDoc<
|
|
22
|
-
TProperties extends PropertiesConstraint,
|
|
23
|
-
> // TisPage extends boolean,
|
|
24
|
-
= _GetPropertiesDoc<TProperties>;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
|
-
import type { InferDetailedType } from "../../../types/InferDetailedType";
|
|
3
|
-
import type { RequiredSingle, RequiredType } from "./PropertiesConstraint";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 获取properties必传字段的文档类型
|
|
7
|
-
* @remarks 小程序中必传字段如果是object,默认类型为null,所以组件文档对象类型要联合上null类型
|
|
8
|
-
*/
|
|
9
|
-
export type GetRequiredDoc<
|
|
10
|
-
TProperties extends Record<string, RequiredType>,
|
|
11
|
-
> // TIsPage extends boolean,
|
|
12
|
-
= {
|
|
13
|
-
-readonly [k in keyof TProperties]: IfExtends<
|
|
14
|
-
TProperties[k],
|
|
15
|
-
// 非对象写法
|
|
16
|
-
RequiredSingle,
|
|
17
|
-
InferDetailedType<TProperties[k]>,
|
|
18
|
-
// @ts-ignore TProperties[k] 必为 RequiredUnion
|
|
19
|
-
| InferDetailedType<TProperties[k]["type"]>
|
|
20
|
-
// @ts-ignore TProperties[k] 必为 RequiredUnion
|
|
21
|
-
| InferDetailedType<TProperties[k]["optionalTypes"][number]>
|
|
22
|
-
>;
|
|
23
|
-
};
|
|
File without changes
|
|
File without changes
|