annil 1.0.6 → 1.0.7
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/DefineComponent/ReturnType/CreatePageDoc.d.ts +3 -6
- package/dist/api/DefineComponent/ReturnType/test/normalPageDoc.test.js +6 -0
- package/dist/api/DefineComponent/ReturnType/test/normalPageDoc.test.js.map +1 -1
- package/dist/api/DefineComponent/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/api/DefineComponent/ReturnType/CreatePageDoc.ts +2 -10
- package/src/api/DefineComponent/ReturnType/test/normalPageDoc.test.ts +9 -0
- package/src/api/DefineComponent/index.ts +1 -1
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.0.7](https://github.com/missannil/annil/compare/v1.0.6...v1.0.7) (2023-12-02)
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
### Bug Fixes
|
|
11
|
+
|
|
12
|
+
* 修复DefinedComponent的subComonsnts字段为[never]类型时,生成page类型错误的情况 ([a8aec74](https://github.com/missannil/annil/commit/a8aec74bbe964585f71d96bebdc85a32241271aa))
|
|
13
|
+
|
|
7
14
|
## [1.0.6](https://github.com/missannil/annil/compare/v1.0.5...v1.0.6) (2023-12-02)
|
|
8
15
|
|
|
9
16
|
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
2
|
import type { ComputeIntersectionDeep } from "hry-types/src/Object/ComputeIntersectionDeep";
|
|
3
|
-
import type { RemoveNullOfRequired } from "../../../types/RemoveNullOfRequired";
|
|
4
3
|
import type { RootComponentDoc } from "../../RootComponent/RootComponentDoc";
|
|
5
|
-
|
|
6
|
-
import type { GetPropertiesDocOfSubDoc } from "./GetPropertiesDocOfSubDoc";
|
|
7
|
-
export type CreatePageDoc<TRootDoc extends RootComponentDoc, TPath extends string, TSubComponentTuple extends SubComponentDoc[], AllPropertiesDoc = TRootDoc["properties"] & GetPropertiesDocOfSubDoc<TSubComponentTuple>> = ComputeIntersectionDeep<{
|
|
4
|
+
export type CreatePageDoc<TRootDoc extends RootComponentDoc, TPath extends string> = ComputeIntersectionDeep<{
|
|
8
5
|
path: TPath;
|
|
9
|
-
} & IfExtends<unknown,
|
|
10
|
-
properties:
|
|
6
|
+
} & IfExtends<unknown, TRootDoc["properties"], unknown, {
|
|
7
|
+
properties: TRootDoc["properties"];
|
|
11
8
|
}>>;
|
|
@@ -22,4 +22,10 @@ const compDocOnlyProperties = DefineComponent({
|
|
|
22
22
|
rootComponent: OnlyPropsRootDoc,
|
|
23
23
|
});
|
|
24
24
|
Checking;
|
|
25
|
+
const whenSubIsAllNever = DefineComponent({
|
|
26
|
+
path: "/pages/index/index",
|
|
27
|
+
rootComponent: OnlyPropsRootDoc,
|
|
28
|
+
subComponents: [{}],
|
|
29
|
+
});
|
|
30
|
+
Checking;
|
|
25
31
|
//# sourceMappingURL=normalPageDoc.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalPageDoc.test.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/ReturnType/test/normalPageDoc.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAChD,OAAO,EAAqB,aAAa,EAAE,MAAM,aAAa,CAAC;AAG/D,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAExC,MAAM,gBAAgB,GAAG,aAAa,EAAE,CAAC;IACvC,MAAM,EAAE,IAAI;IACZ,UAAU,EAAE;QACV,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAAiC;QACtC,WAAW,EAAE;YACX,IAAI,EAAE,MAAiC;YACvC,KAAK,EAAE,EAAe;SACvB;QACD,iBAAiB,EAAE;YACjB,IAAI,EAAE,MAAwC;YAC9C,KAAK,EAAE,IAAI;SACZ;KACF;IACD,YAAY,EAAE,EAAE;CACjB,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,eAAe,CAAC;IAC5C,IAAI,EAAE,oBAAoB;IAC1B,aAAa,EAAE,gBAAgB;CAChC,CAAC,CAAC;AAaH,QAAgF,CAAC"}
|
|
1
|
+
{"version":3,"file":"normalPageDoc.test.js","sourceRoot":"","sources":["../../../../../src/api/DefineComponent/ReturnType/test/normalPageDoc.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAa,MAAM,WAAW,CAAC;AAChD,OAAO,EAAqB,aAAa,EAAE,MAAM,aAAa,CAAC;AAG/D,OAAO,EAAE,eAAe,EAAE,MAAM,OAAO,CAAC;AAExC,MAAM,gBAAgB,GAAG,aAAa,EAAE,CAAC;IACvC,MAAM,EAAE,IAAI;IACZ,UAAU,EAAE;QACV,GAAG,EAAE,MAAM;QACX,GAAG,EAAE,MAAiC;QACtC,WAAW,EAAE;YACX,IAAI,EAAE,MAAiC;YACvC,KAAK,EAAE,EAAe;SACvB;QACD,iBAAiB,EAAE;YACjB,IAAI,EAAE,MAAwC;YAC9C,KAAK,EAAE,IAAI;SACZ;KACF;IACD,YAAY,EAAE,EAAE;CACjB,CAAC,CAAC;AAEH,MAAM,qBAAqB,GAAG,eAAe,CAAC;IAC5C,IAAI,EAAE,oBAAoB;IAC1B,aAAa,EAAE,gBAAgB;CAChC,CAAC,CAAC;AAaH,QAAgF,CAAC;AAGjF,MAAM,iBAAiB,GAAG,eAAe,CAAC;IACxC,IAAI,EAAE,oBAAoB;IAC1B,aAAa,EAAE,gBAAgB;IAC/B,aAAa,EAAE,CAAC,EAAW,CAAC;CAC7B,CAAC,CAAC;AAEH,QAA4E,CAAC"}
|
|
@@ -12,7 +12,7 @@ import type { SubComponentsOption } from "./SubComponents/SubComponentsOption";
|
|
|
12
12
|
type Path = `/${string}`;
|
|
13
13
|
type RootOptions<TRootComponentDoc extends RootComponentDoc, TSubComponentTuple extends SubComponentDoc[], TName extends string, TPath extends Path> = NameOrPathOption<TName, TPath, TRootComponentDoc> & RootComponentOption<TRootComponentDoc> & SubComponentsOption<TSubComponentTuple>;
|
|
14
14
|
interface DefineComponentConstructor {
|
|
15
|
-
<TRootComponentDoc extends RootComponentDoc = {}, TSubComponentTuple extends SubComponentDoc[] = [], TName extends string = "", TPath extends Path = "/">(options: RootOptions<TRootComponentDoc, TSubComponentTuple, TName, TPath>): IfExtends<"", TName, CreatePageDoc<TRootComponentDoc, TPath
|
|
15
|
+
<TRootComponentDoc extends RootComponentDoc = {}, TSubComponentTuple extends SubComponentDoc[] = [], TName extends string = "", TPath extends Path = "/">(options: RootOptions<TRootComponentDoc, TSubComponentTuple, TName, TPath>): IfExtends<"", TName, CreatePageDoc<TRootComponentDoc, TPath>, CreateComponentDoc<TRootComponentDoc, TName, TSubComponentTuple>>;
|
|
16
16
|
}
|
|
17
17
|
export type FuncOptions = Record<"pageLifetimes" | "lifetimes" | "watch", Record<string, Func[]>>;
|
|
18
18
|
export type FinalOptionsForComponent = {
|
package/package.json
CHANGED
|
@@ -1,26 +1,18 @@
|
|
|
1
1
|
import type { IfExtends } from "hry-types/src/Any/IfExtends";
|
|
2
2
|
import type { ComputeIntersectionDeep } from "hry-types/src/Object/ComputeIntersectionDeep";
|
|
3
|
-
import type { RemoveNullOfRequired } from "../../../types/RemoveNullOfRequired";
|
|
4
3
|
import type { RootComponentDoc } from "../../RootComponent/RootComponentDoc";
|
|
5
|
-
import type { SubComponentDoc } from "../../SubComponent/SubComponentDoc";
|
|
6
|
-
import type { GetPropertiesDocOfSubDoc } from "./GetPropertiesDocOfSubDoc";
|
|
7
4
|
|
|
8
5
|
export type CreatePageDoc<
|
|
9
6
|
TRootDoc extends RootComponentDoc,
|
|
10
7
|
TPath extends string,
|
|
11
|
-
TSubComponentTuple extends SubComponentDoc[],
|
|
12
|
-
// 获取所有properties字段
|
|
13
|
-
AllPropertiesDoc = TRootDoc["properties"] & GetPropertiesDocOfSubDoc<TSubComponentTuple>,
|
|
14
8
|
> = ComputeIntersectionDeep<
|
|
15
9
|
& { path: TPath }
|
|
16
10
|
& IfExtends<
|
|
17
11
|
unknown,
|
|
18
|
-
|
|
12
|
+
TRootDoc["properties"],
|
|
19
13
|
unknown,
|
|
20
14
|
{
|
|
21
|
-
|
|
22
|
-
// RemoveNullOfRequired 页面传值时必传字段不需要RootComponent返回时为对象加入的null类型
|
|
23
|
-
properties: RemoveNullOfRequired<AllPropertiesDoc>;
|
|
15
|
+
properties: TRootDoc["properties"];
|
|
24
16
|
}
|
|
25
17
|
>
|
|
26
18
|
>;
|
|
@@ -38,3 +38,12 @@ type CompDocOnlyPropertiesExpected = {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
Checking<typeof compDocOnlyProperties, CompDocOnlyPropertiesExpected, Test.Pass>;
|
|
41
|
+
|
|
42
|
+
// 页面类型不受subComponents是[never,never]时影响
|
|
43
|
+
const whenSubIsAllNever = DefineComponent({
|
|
44
|
+
path: "/pages/index/index",
|
|
45
|
+
rootComponent: OnlyPropsRootDoc,
|
|
46
|
+
subComponents: [{} as never],
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
Checking<typeof whenSubIsAllNever, CompDocOnlyPropertiesExpected, Test.Pass>;
|
|
@@ -39,7 +39,7 @@ interface DefineComponentConstructor {
|
|
|
39
39
|
"",
|
|
40
40
|
TName,
|
|
41
41
|
// 生成页面文档
|
|
42
|
-
CreatePageDoc<TRootComponentDoc, TPath
|
|
42
|
+
CreatePageDoc<TRootComponentDoc, TPath>,
|
|
43
43
|
// 生成组件文档
|
|
44
44
|
CreateComponentDoc<TRootComponentDoc, TName, TSubComponentTuple>
|
|
45
45
|
>;
|