Skip to content

Commit 47f16a5

Browse files
committed
chore: cleanup mixins/types
1 parent 5b59e91 commit 47f16a5

18 files changed

+83
-77
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { type DefaultableSchemaMixin } from "../../generated/DefaultableSchemaMixin";
22
import type { Constructor } from "../../utils/types";
33
import { InMemoryEntity } from "../in_memory";
4-
export type DefaultableInMemoryEntity = DefaultableSchemaMixin;
4+
export type Defaultable = DefaultableSchemaMixin;
5+
export type DefaultableInMemoryEntity = Defaultable;
56
export type DefaultableInMemoryStaticEntity = {
6-
createDefault: () => InMemoryEntity & DefaultableSchemaMixin;
7+
createDefault: () => InMemoryEntity & Defaultable;
78
};
8-
export type DefaultableInMemoryEntityConstructor = Constructor<DefaultableSchemaMixin> & DefaultableInMemoryStaticEntity;
9+
export type DefaultableInMemoryEntityConstructor = Constructor<Defaultable> & DefaultableInMemoryStaticEntity;
910
export declare function defaultableEntityMixin(Item: Constructor<InMemoryEntity>): void;

dist/js/entity/mixins/HasConsistencyChecksMixin.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ import { InMemoryEntity } from "../in_memory";
55
type HasConsistencyChecksProperties = {
66
addConsistencyChecks: (array: ConsistencyCheck[]) => void;
77
};
8-
type HasConsistencyChecks = HasConsistencyChecksSchemaMixin & HasConsistencyChecksProperties;
8+
export type HasConsistencyChecks = HasConsistencyChecksSchemaMixin & HasConsistencyChecksProperties;
9+
export type HasConsistencyChecksInMemoryEntity = HasConsistencyChecks;
10+
export type HasConsistencyChecksInMemoryEntityConstructor = Constructor<HasConsistencyChecks>;
911
export declare function hasConsistencyChecksMixin<T extends InMemoryEntity>(item: T): asserts item is T & HasConsistencyChecks;
10-
export type HasConsistencyChecksInMemoryEntity = HasConsistencyChecksSchemaMixin & HasConsistencyChecksProperties;
11-
export type HasConsistencyChecksInMemoryEntityConstructor = Constructor<HasConsistencyChecksInMemoryEntity>;
1212
export {};
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { type HasDescriptionSchemaMixin } from "../../generated/HasDescriptionSchemaMixin";
22
import type { Constructor } from "../../utils/types";
33
import { InMemoryEntity } from "../in_memory";
4-
export declare function hasDescriptionMixin<T extends InMemoryEntity>(item: T): asserts item is T & HasDescriptionSchemaMixin;
4+
export type HasDescription = HasDescriptionSchemaMixin;
55
export type HasDescriptionInMemoryEntity = HasDescriptionSchemaMixin;
66
export type HasDescriptionInMemoryEntityConstructor = Constructor<HasDescriptionInMemoryEntity>;
7+
export declare function hasDescriptionMixin<T extends InMemoryEntity>(item: T): asserts item is T & HasDescriptionSchemaMixin;

dist/js/entity/mixins/HasMetadataMixin.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { InMemoryEntity } from "../in_memory";
44
type HasMetadataProperties = {
55
updateMetadata: (object: object) => void;
66
};
7-
type HasMetadata = HasMetadataSchemaMixin & HasMetadataProperties;
8-
export declare function hasMetadataMixin<T extends InMemoryEntity>(item: T): asserts item is T & HasMetadata;
9-
export type HasMetadataInMemoryEntity = HasMetadataSchemaMixin & HasMetadataProperties;
7+
export type HasMetadata = HasMetadataSchemaMixin & HasMetadataProperties;
8+
export type HasMetadataInMemoryEntity = HasMetadata;
109
export type HasMetadataInMemoryEntityConstructor = Constructor<HasMetadataInMemoryEntity>;
10+
export declare function hasMetadataMixin<T extends InMemoryEntity>(item: T): asserts item is T & HasMetadata;
1111
export {};
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import { type HasDescriptionSchemaMixin } from "../../generated/HasDescriptionSchemaMixin";
21
import type { Constructor } from "../../utils/types";
32
import { InMemoryEntity } from "../in_memory";
4-
type HashedEntityProperties = {
3+
export type HashedEntity = {
54
calculateHash: () => string;
65
getHashObject?: () => object;
76
};
8-
export declare function hashedEntityMixin<T extends InMemoryEntity>(item: T): asserts item is T & HashedEntityProperties;
9-
export type HasDescriptionInMemoryEntity = HasDescriptionSchemaMixin;
10-
export type HasDescriptionInMemoryEntityConstructor = Constructor<HasDescriptionInMemoryEntity>;
11-
export {};
7+
export type HashedEntityInMemoryEntity = HashedEntity;
8+
export type HashedEntityInMemoryEntityConstructor = Constructor<HashedEntityInMemoryEntity>;
9+
export declare function hashedEntityMixin<T extends InMemoryEntity>(item: T): asserts item is T & HashedEntity;

dist/js/entity/mixins/NamedEntityMixin.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ import { InMemoryEntity } from "../in_memory";
44
type NamedEntityProperties = {
55
setName: (name: string) => void;
66
};
7-
export declare function namedEntityMixin<T extends InMemoryEntity>(item: T): asserts item is T & NamedEntityProperties;
8-
export type NamedInMemoryEntity = NamedEntitySchemaMixin & NamedEntityProperties;
7+
export type NamedEntity = NamedEntitySchemaMixin & NamedEntityProperties;
8+
export type NamedInMemoryEntity = NamedEntity;
99
export type NamedInMemoryEntityConstructor = Constructor<NamedInMemoryEntity>;
10+
export declare function namedEntityMixin<T extends InMemoryEntity>(item: T): asserts item is T & NamedEntityProperties;
1011
export {};

dist/js/entity/mixins/RuntimeItemsNameObjectMixin.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ type RuntimeItemsNameObjectProperties = {
88
postProcessors: RuntimeItemsNameObjectSchemaMixin["postProcessors"];
99
};
1010
};
11-
type RuntimeItemsNameObject = RuntimeItemsNameObjectSchemaMixin & RuntimeItemsNameObjectProperties;
11+
export type RuntimeItemsNameObject = RuntimeItemsNameObjectSchemaMixin & RuntimeItemsNameObjectProperties;
12+
export type RuntimeItemsNameObjectInMemoryEntity = RuntimeItemsNameObject;
13+
export type RuntimeItemsNameObjectInMemoryEntityConstructor = Constructor<RuntimeItemsNameObject>;
1214
export declare function runtimeItemsNameObjectMixin<T extends InMemoryEntity>(item: T): asserts item is T & RuntimeItemsNameObject;
13-
export type RuntimeItemsNameObjectInMemoryEntity = RuntimeItemsNameObjectSchemaMixin & RuntimeItemsNameObjectProperties;
14-
export type RuntimeItemsNameObjectInMemoryEntityConstructor = Constructor<RuntimeItemsNameObjectInMemoryEntity>;
1515
export {};
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { type RuntimeItemsStringSchemaMixin, runtimeItemsStringSchemaMixin } from "../../generated/RuntimeItemsStringSchemaMixin";
22
import type { Constructor } from "../../utils/types";
3-
export declare const runtimeItemsStringMixin: typeof runtimeItemsStringSchemaMixin;
4-
export type RuntimeItemsStringInMemoryEntity = RuntimeItemsStringSchemaMixin;
3+
export type RuntimeItemsString = RuntimeItemsStringSchemaMixin;
4+
export type RuntimeItemsStringInMemoryEntity = RuntimeItemsString;
55
export type RuntimeItemsStringInMemoryEntityConstructor = Constructor<RuntimeItemsStringInMemoryEntity>;
6+
export declare const runtimeItemsStringMixin: typeof runtimeItemsStringSchemaMixin;

dist/js/entity/mixins/TaggableMixin.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import { InMemoryEntity } from "../in_memory";
44
type TaggableProperties = {
55
setTags: (array: string[]) => void;
66
};
7-
type Taggable = TaggableSchemaMixin & TaggableProperties;
8-
export declare function taggableMixin<T extends InMemoryEntity>(item: T): asserts item is T & Taggable;
9-
export type TaggableInMemoryEntity = TaggableSchemaMixin & TaggableProperties;
7+
export type Taggable = TaggableSchemaMixin & TaggableProperties;
8+
export type TaggableInMemoryEntity = Taggable;
109
export type TaggableInMemoryEntityConstructor = Constructor<TaggableInMemoryEntity>;
10+
export declare function taggableMixin<T extends InMemoryEntity>(item: T): asserts item is T & Taggable;
1111
export {};

src/js/entity/mixins/DefaultableMixin.ts

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,17 @@ import {
77
import type { Constructor } from "../../utils/types";
88
import { InMemoryEntity } from "../in_memory";
99

10+
export type Defaultable = DefaultableSchemaMixin;
11+
12+
export type DefaultableInMemoryEntity = Defaultable;
13+
14+
export type DefaultableInMemoryStaticEntity = {
15+
createDefault: () => InMemoryEntity & Defaultable;
16+
};
17+
18+
export type DefaultableInMemoryEntityConstructor = Constructor<Defaultable> &
19+
DefaultableInMemoryStaticEntity;
20+
1021
function defaultableEntityStaticMixin(Item: Constructor<InMemoryEntity>) {
1122
// @ts-expect-error
1223
const staticProperties: DefaultableInMemoryStaticEntity &
@@ -24,15 +35,6 @@ function defaultableEntityStaticMixin(Item: Constructor<InMemoryEntity>) {
2435
return staticProperties;
2536
}
2637

27-
export type DefaultableInMemoryEntity = DefaultableSchemaMixin;
28-
29-
export type DefaultableInMemoryStaticEntity = {
30-
createDefault: () => InMemoryEntity & DefaultableSchemaMixin;
31-
};
32-
33-
export type DefaultableInMemoryEntityConstructor = Constructor<DefaultableSchemaMixin> &
34-
DefaultableInMemoryStaticEntity;
35-
3638
export function defaultableEntityMixin(Item: Constructor<InMemoryEntity>) {
3739
defaultableSchemaMixin(Item.prototype);
3840
defaultableEntityStaticMixin(Item);

0 commit comments

Comments
 (0)