Skip to content

Commit 6894ec8

Browse files
committed
chore: update TS types
1 parent d77ba96 commit 6894ec8

File tree

13 files changed

+124
-78
lines changed

13 files changed

+124
-78
lines changed

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

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { type ConsistencyCheck } from "@mat3ra/esse/dist/js/types";
2-
import { InMemoryEntityConstructor } from "../in_memory";
3-
export declare function DefaultableMixin<T extends InMemoryEntityConstructor>(superclass: T): {
2+
import type { Constructor } from "../../utils/types";
3+
import { type InMemoryEntity, InMemoryEntityConstructor } from "../in_memory";
4+
export declare function DefaultableMixin<T extends Constructor<InMemoryEntity> = Constructor<InMemoryEntity>>(superclass: T): {
45
new (...args: any[]): {
56
readonly isDefault: boolean;
67
_json: import("@mat3ra/esse/dist/js/esse/types").AnyObject;
@@ -19,7 +20,7 @@ export declare function DefaultableMixin<T extends InMemoryEntityConstructor>(su
1920
readonly cls: string;
2021
getClsName(): string;
2122
getAsEntityReference(byIdOnly?: boolean): import("@mat3ra/esse/dist/js/types").EntityReferenceSchema;
22-
getEntityByName(entities: import("../in_memory").InMemoryEntity[], entity: string, name: string): import("../in_memory").InMemoryEntity;
23+
getEntityByName(entities: InMemoryEntity[], entity: string, name: string): InMemoryEntity;
2324
id: string;
2425
_id: string;
2526
schemaVersion: string;
@@ -50,7 +51,7 @@ export declare function TaggableMixin<T extends InMemoryEntityConstructor>(super
5051
readonly cls: string;
5152
getClsName(): string;
5253
getAsEntityReference(byIdOnly?: boolean): import("@mat3ra/esse/dist/js/types").EntityReferenceSchema;
53-
getEntityByName(entities: import("../in_memory").InMemoryEntity[], entity: string, name: string): import("../in_memory").InMemoryEntity;
54+
getEntityByName(entities: InMemoryEntity[], entity: string, name: string): InMemoryEntity;
5455
id: string;
5556
_id: string;
5657
schemaVersion: string;
@@ -78,7 +79,7 @@ export declare function HasScopeTrackMixin<T extends InMemoryEntityConstructor>(
7879
readonly cls: string;
7980
getClsName(): string;
8081
getAsEntityReference(byIdOnly?: boolean): import("@mat3ra/esse/dist/js/types").EntityReferenceSchema;
81-
getEntityByName(entities: import("../in_memory").InMemoryEntity[], entity: string, name: string): import("../in_memory").InMemoryEntity;
82+
getEntityByName(entities: InMemoryEntity[], entity: string, name: string): InMemoryEntity;
8283
id: string;
8384
_id: string;
8485
schemaVersion: string;
@@ -107,7 +108,7 @@ export declare function HasMetadataMixin<T extends InMemoryEntityConstructor>(su
107108
readonly cls: string;
108109
getClsName(): string;
109110
getAsEntityReference(byIdOnly?: boolean): import("@mat3ra/esse/dist/js/types").EntityReferenceSchema;
110-
getEntityByName(entities: import("../in_memory").InMemoryEntity[], entity: string, name: string): import("../in_memory").InMemoryEntity;
111+
getEntityByName(entities: InMemoryEntity[], entity: string, name: string): InMemoryEntity;
111112
id: string;
112113
_id: string;
113114
schemaVersion: string;
@@ -136,7 +137,7 @@ export declare function HasDescriptionMixin<T extends InMemoryEntityConstructor>
136137
readonly cls: string;
137138
getClsName(): string;
138139
getAsEntityReference(byIdOnly?: boolean): import("@mat3ra/esse/dist/js/types").EntityReferenceSchema;
139-
getEntityByName(entities: import("../in_memory").InMemoryEntity[], entity: string, name: string): import("../in_memory").InMemoryEntity;
140+
getEntityByName(entities: InMemoryEntity[], entity: string, name: string): InMemoryEntity;
140141
id: string;
141142
_id: string;
142143
schemaVersion: string;
@@ -165,7 +166,7 @@ export declare function NamedEntityMixin<T extends InMemoryEntityConstructor>(su
165166
readonly cls: string;
166167
getClsName(): string;
167168
getAsEntityReference(byIdOnly?: boolean): import("@mat3ra/esse/dist/js/types").EntityReferenceSchema;
168-
getEntityByName(entities: import("../in_memory").InMemoryEntity[], entity: string, name: string): import("../in_memory").InMemoryEntity;
169+
getEntityByName(entities: InMemoryEntity[], entity: string, name: string): InMemoryEntity;
169170
id: string;
170171
_id: string;
171172
schemaVersion: string;
@@ -194,7 +195,7 @@ export declare function HasConsistencyChecksMixin<T extends InMemoryEntityConstr
194195
readonly cls: string;
195196
getClsName(): string;
196197
getAsEntityReference(byIdOnly?: boolean): import("@mat3ra/esse/dist/js/types").EntityReferenceSchema;
197-
getEntityByName(entities: import("../in_memory").InMemoryEntity[], entity: string, name: string): import("../in_memory").InMemoryEntity;
198+
getEntityByName(entities: InMemoryEntity[], entity: string, name: string): InMemoryEntity;
198199
id: string;
199200
_id: string;
200201
schemaVersion: string;

dist/js/entity/other.d.ts

Lines changed: 88 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export declare const NamedDefaultableInMemoryEntity: {
118118
readonly defaultConfig: object | null;
119119
createDefault(): any;
120120
} & typeof InMemoryEntity;
121-
declare const HasMetadataNamedDefaultableInMemoryEntity_base: {
121+
export declare const HasMetadataNamedDefaultableInMemoryEntity: {
122122
new (...args: any[]): {
123123
metadata: object;
124124
updateMetadata(object: object): void;
@@ -204,9 +204,7 @@ declare const HasMetadataNamedDefaultableInMemoryEntity_base: {
204204
readonly defaultConfig: object | null;
205205
createDefault(): any;
206206
} & typeof InMemoryEntity;
207-
export declare class HasMetadataNamedDefaultableInMemoryEntity extends HasMetadataNamedDefaultableInMemoryEntity_base {
208-
}
209-
declare const HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity_base: {
207+
export declare const HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity: {
210208
new (...args: any[]): {
211209
consistencyChecks: import("@mat3ra/esse/dist/js/types").ConsistencyCheck[];
212210
addConsistencyChecks(array: import("@mat3ra/esse/dist/js/types").ConsistencyCheck[]): void;
@@ -234,9 +232,92 @@ declare const HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity_base
234232
readonly slug: string;
235233
readonly isSystemEntity: boolean;
236234
};
237-
} & typeof HasMetadataNamedDefaultableInMemoryEntity;
238-
export declare class HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity extends HasConsistencyChecksHasMetadataNamedDefaultableInMemoryEntity_base {
239-
}
235+
} & {
236+
new (...args: any[]): {
237+
metadata: object;
238+
updateMetadata(object: object): void;
239+
_json: import("@mat3ra/esse/dist/js/esse/types").AnyObject;
240+
prop<T = undefined>(name: string, defaultValue: T): T;
241+
prop<T = undefined>(name: string): T | undefined;
242+
setProp(name: string, value: unknown): void;
243+
unsetProp(name: string): void;
244+
setProps(json?: import("@mat3ra/esse/dist/js/esse/types").AnyObject): /*elided*/ any;
245+
toJSON(exclude?: string[]): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
246+
toJSONSafe(exclude?: string[]): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
247+
toJSONQuick(exclude?: string[]): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
248+
clone(extraContext?: object): /*elided*/ any;
249+
validate(): void;
250+
clean(config: import("@mat3ra/esse/dist/js/esse/types").AnyObject): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
251+
isValid(): boolean;
252+
readonly cls: string;
253+
getClsName(): string;
254+
getAsEntityReference(byIdOnly?: boolean): import("@mat3ra/esse/dist/js/types").EntityReferenceSchema;
255+
getEntityByName(entities: InMemoryEntity[], entity: string, name: string): InMemoryEntity;
256+
id: string;
257+
_id: string;
258+
schemaVersion: string;
259+
systemName: string;
260+
readonly slug: string;
261+
readonly isSystemEntity: boolean;
262+
};
263+
} & {
264+
new (...args: any[]): {
265+
name: string;
266+
setName(name: string): void;
267+
_json: import("@mat3ra/esse/dist/js/esse/types").AnyObject;
268+
prop<T = undefined>(name: string, defaultValue: T): T;
269+
prop<T = undefined>(name: string): T | undefined;
270+
setProp(name: string, value: unknown): void;
271+
unsetProp(name: string): void;
272+
setProps(json?: import("@mat3ra/esse/dist/js/esse/types").AnyObject): /*elided*/ any;
273+
toJSON(exclude?: string[]): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
274+
toJSONSafe(exclude?: string[]): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
275+
toJSONQuick(exclude?: string[]): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
276+
clone(extraContext?: object): /*elided*/ any;
277+
validate(): void;
278+
clean(config: import("@mat3ra/esse/dist/js/esse/types").AnyObject): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
279+
isValid(): boolean;
280+
readonly cls: string;
281+
getClsName(): string;
282+
getAsEntityReference(byIdOnly?: boolean): import("@mat3ra/esse/dist/js/types").EntityReferenceSchema;
283+
getEntityByName(entities: InMemoryEntity[], entity: string, name: string): InMemoryEntity;
284+
id: string;
285+
_id: string;
286+
schemaVersion: string;
287+
systemName: string;
288+
readonly slug: string;
289+
readonly isSystemEntity: boolean;
290+
};
291+
} & {
292+
new (...args: any[]): {
293+
readonly isDefault: boolean;
294+
_json: import("@mat3ra/esse/dist/js/esse/types").AnyObject;
295+
prop<T = undefined>(name: string, defaultValue: T): T;
296+
prop<T = undefined>(name: string): T | undefined;
297+
setProp(name: string, value: unknown): void;
298+
unsetProp(name: string): void;
299+
setProps(json?: import("@mat3ra/esse/dist/js/esse/types").AnyObject): /*elided*/ any;
300+
toJSON(exclude?: string[]): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
301+
toJSONSafe(exclude?: string[]): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
302+
toJSONQuick(exclude?: string[]): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
303+
clone(extraContext?: object): /*elided*/ any;
304+
validate(): void;
305+
clean(config: import("@mat3ra/esse/dist/js/esse/types").AnyObject): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
306+
isValid(): boolean;
307+
readonly cls: string;
308+
getClsName(): string;
309+
getAsEntityReference(byIdOnly?: boolean): import("@mat3ra/esse/dist/js/types").EntityReferenceSchema;
310+
getEntityByName(entities: InMemoryEntity[], entity: string, name: string): InMemoryEntity;
311+
id: string;
312+
_id: string;
313+
schemaVersion: string;
314+
systemName: string;
315+
readonly slug: string;
316+
readonly isSystemEntity: boolean;
317+
};
318+
readonly defaultConfig: object | null;
319+
createDefault(): any;
320+
} & typeof InMemoryEntity;
240321
export declare const NamedDefaultableRepetitionImportantSettingsInMemoryEntity: {
241322
new (...args: any[]): {
242323
readonly important: any;

dist/js/entity/other.js

Lines changed: 2 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js/entity/set.d.ts

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,7 @@
11
import { InMemoryEntity } from "./in_memory";
22
declare const InMemoryEntitySet_base: {
33
new (...args: any[]): {
4-
containsEntity<T extends {
5-
inSet: import("./set/mixins").InSet[];
6-
getInSetFilteredByCls(cls: string): {
7-
_id: string;
8-
cls?: string;
9-
slug?: string;
10-
type?: string;
11-
index?: number;
12-
}[];
13-
readonly parentEntitySetReference: {
14-
_id: string;
15-
cls?: string;
16-
slug?: string;
17-
type?: string;
18-
index?: number;
19-
} | undefined;
20-
_json: import("@mat3ra/esse/dist/js/esse/types").AnyObject;
21-
prop<T_1 = undefined>(name: string, defaultValue: T_1): T_1;
22-
prop<T_1 = undefined>(name: string): T_1 | undefined;
23-
setProp(name: string, value: unknown): void;
24-
unsetProp(name: string): void;
25-
setProps(json?: import("@mat3ra/esse/dist/js/esse/types").AnyObject): /*elided*/ any;
26-
toJSON(exclude?: string[]): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
27-
toJSONSafe(exclude?: string[]): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
28-
toJSONQuick(exclude?: string[]): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
29-
clone(extraContext?: object): /*elided*/ any;
30-
validate(): void;
31-
clean(config: import("@mat3ra/esse/dist/js/esse/types").AnyObject): import("@mat3ra/esse/dist/js/esse/types").AnyObject;
32-
isValid(): boolean;
33-
readonly cls: string;
34-
getClsName(): string;
35-
getAsEntityReference(byIdOnly?: boolean): import("@mat3ra/esse/dist/js/types").EntityReferenceSchema;
36-
getEntityByName(entities: InMemoryEntity[], entity: string, name: string): InMemoryEntity;
37-
id: string;
38-
_id: string;
39-
schemaVersion: string;
40-
systemName: string;
41-
readonly slug: string;
42-
readonly isSystemEntity: boolean;
43-
} & InMemoryEntity>(entity?: T | undefined): boolean | undefined;
4+
containsEntity<T extends import("@mat3ra/esse/dist/js/types").SystemInSetSchema>(entity?: T | undefined): boolean;
445
_json: import("@mat3ra/esse/dist/js/esse/types").AnyObject;
456
prop<T = undefined>(name: string, defaultValue: T): T;
467
prop<T = undefined>(name: string): T | undefined;

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

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,9 @@ export declare function InMemoryEntityInSetMixin<T extends InMemoryEntityConstru
4444
readonly isSystemEntity: boolean;
4545
};
4646
} & T;
47-
type BaseEntityInSet = InstanceType<ReturnType<typeof InMemoryEntityInSetMixin>>;
4847
export declare function InMemoryEntitySetMixin<T extends InMemoryEntityConstructor>(superclass: T): {
4948
new (...args: any[]): {
50-
containsEntity<T_1 extends BaseEntityInSet>(entity?: T_1 | undefined): boolean | undefined;
49+
containsEntity<T_1 extends SystemInSetSchema>(entity?: T_1 | undefined): boolean;
5150
_json: import("@mat3ra/esse/dist/js/esse/types").AnyObject;
5251
prop<T_1 = undefined>(name: string, defaultValue: T_1): T_1;
5352
prop<T_1 = undefined>(name: string): T_1 | undefined;
@@ -73,4 +72,3 @@ export declare function InMemoryEntitySetMixin<T extends InMemoryEntityConstruct
7372
readonly isSystemEntity: boolean;
7473
};
7574
} & T;
76-
export {};

dist/js/entity/set/mixins.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ function InMemoryEntityInSetMixin(superclass) {
2323
function InMemoryEntitySetMixin(superclass) {
2424
return class InMemoryEntitySetMixin extends superclass {
2525
containsEntity(entity) {
26-
return entity === null || entity === void 0 ? void 0 : entity.inSet.some((ref) => ref._id === this.id);
26+
var _a;
27+
return Boolean((_a = entity === null || entity === void 0 ? void 0 : entity.inSet) === null || _a === void 0 ? void 0 : _a.some((ref) => ref._id === this.id));
2728
}
2829
};
2930
}

dist/js/utils/types.d.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
export type Constructor<T> = new (...args: any[]) => T;
2+
export type AbstractConstructor<T> = abstract new (...args: any[]) => T;

dist/js/utils/types.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
"use strict";
2+
Object.defineProperty(exports, "__esModule", { value: true });

src/js/entity/in_memory.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ export class InMemoryEntity implements BaseInMemoryEntitySchema {
174174
}
175175
}
176176

177-
static get cls() {
177+
static get cls(): string {
178178
return this.prototype.constructor.name;
179179
}
180180

src/js/entity/mixins/props.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ import {
88
type NameEntitySchema,
99
} from "@mat3ra/esse/dist/js/types";
1010

11-
import { InMemoryEntityConstructor } from "../in_memory";
11+
import type { Constructor } from "../../utils/types";
12+
import { type InMemoryEntity, InMemoryEntityConstructor } from "../in_memory";
1213

13-
export function DefaultableMixin<T extends InMemoryEntityConstructor>(superclass: T) {
14+
export function DefaultableMixin<
15+
T extends Constructor<InMemoryEntity> = Constructor<InMemoryEntity>,
16+
>(superclass: T) {
1417
class DefaultableMixin extends superclass implements DefaultableEntitySchema {
1518
get isDefault() {
1619
return this.prop("isDefault", false);

0 commit comments

Comments
 (0)