Skip to content

Commit de556cc

Browse files
committed
fix: mixin types
1 parent 719ce0f commit de556cc

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

dist/js/entity/set/InMemoryEntitySetBaseMixin.d.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,14 @@ import type { Constructor } from "../../utils/types";
33
import { type InMemoryEntity } from "../in_memory";
44
export type SystemInSet = Required<SystemInSetSchema>;
55
export type InSet = SystemInSet["inSet"][0];
6+
export declare enum EntitySetType {
7+
ordered = "ordered",
8+
unordered = "unordered"
9+
}
610
declare function schemaMixin<E extends InMemoryEntity>(item: E): {
711
readonly isEntitySet: boolean;
8-
readonly entitySetType: undefined;
9-
readonly entityCls: undefined;
12+
readonly entitySetType: EntitySetType;
13+
readonly entityCls: string | undefined;
1014
};
1115
declare function methodsMixin<E extends InMemoryEntity>(item: E & EntitySetSchema): {
1216
readonly cls: string;

dist/js/entity/set/InMemoryEntitySetBaseMixin.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
"use strict";
22
Object.defineProperty(exports, "__esModule", { value: true });
3+
exports.EntitySetType = void 0;
34
exports.inMemoryEntitySetBaseMixin = inMemoryEntitySetBaseMixin;
45
exports.default = InMemoryEntitySetBaseMixin;
6+
var EntitySetType;
7+
(function (EntitySetType) {
8+
EntitySetType["ordered"] = "ordered";
9+
EntitySetType["unordered"] = "unordered";
10+
})(EntitySetType || (exports.EntitySetType = EntitySetType = {}));
511
function schemaMixin(item) {
612
const schema = {
713
get isEntitySet() {
814
return item.prop("isEntitySet", false);
915
},
1016
get entitySetType() {
11-
return item.prop("entitySetType");
17+
return item.prop("entitySetType", EntitySetType.unordered);
1218
},
1319
get entityCls() {
1420
return item.prop("entityCls");

src/js/entity/set/InMemoryEntitySetBaseMixin.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,23 @@ import { type InMemoryEntity } from "../in_memory";
77
export type SystemInSet = Required<SystemInSetSchema>;
88
export type InSet = SystemInSet["inSet"][0];
99

10+
export enum EntitySetType {
11+
ordered = "ordered",
12+
unordered = "unordered",
13+
}
14+
1015
function schemaMixin<E extends InMemoryEntity>(item: E) {
1116
const schema = {
1217
get isEntitySet() {
1318
return item.prop("isEntitySet", false);
1419
},
1520

1621
get entitySetType() {
17-
return item.prop("entitySetType");
22+
return item.prop("entitySetType", EntitySetType.unordered);
1823
},
1924

2025
get entityCls() {
21-
return item.prop("entityCls");
26+
return item.prop<string | undefined>("entityCls");
2227
},
2328
} satisfies EntitySetSchema;
2429

0 commit comments

Comments
 (0)