Skip to content

Commit

Permalink
Add create and extend methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mattheyan committed Apr 19, 2024
1 parent d8c5e62 commit e862d02
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/type.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Model } from "./model";
import { Entity, EntityInitNewEventArgs, EntityInitExistingEventArgs, EntityRegisteredEventArgs, EntityConstructor, EntityOfType, EntityInitNewEventArgsForType, EntityInitExistingEventArgsForType, EntityConstructorForType } from "./entity";
import { Entity, EntityInitNewEventArgs, EntityInitExistingEventArgs, EntityRegisteredEventArgs, EntityConstructor, EntityOfType, EntityInitNewEventArgsForType, EntityInitExistingEventArgsForType, EntityConstructorForType, EntityArgsOfType } from "./entity";
import { Property, PropertyOptions, Property$generateOwnProperty, Property$generatePrototypeProperty, Property$generateShortcuts } from "./property";
import { navigateAttribute, getTypeName, parseFunctionName, ensureNamespace, getGlobalObject, entries } from "./helpers";
import { Event, EventSubscriber } from "./events";
Expand Down Expand Up @@ -524,14 +524,19 @@ export interface TypeOfType<T> extends Type {
readonly jstype: EntityConstructorForType<T>;
readonly initNew: EventSubscriber<TypeOfType<T>, EntityInitNewEventArgsForType<T>>;
readonly initExisting: EventSubscriber<TypeOfType<T>, EntityInitExistingEventArgsForType<T>>;
createIfNotExists(state: EntityArgsOfType<T>): EntityOfType<T>;
createIfNotExists(state: any): EntityOfType<T>;
createSync(state: EntityArgsOfType<T>): EntityOfType<T>;
createSync(state: any): EntityOfType<T>;
create(state: EntityArgsOfType<T>): Promise<EntityOfType<T>>;
create(state: any): Promise<EntityOfType<T>>;
register(obj: EntityOfType<T>): void;
changeObjectId(oldId: string, newId: string): EntityOfType<T> | void;
get(id: string, exactTypeOnly?: boolean): EntityOfType<T>;
known(): EntityOfType<T>[];
addRule(optionsOrFunction: ((this: EntityOfType<T>) => void) | RuleOptions): Rule;
extend(options: TypeExtensionOptionsForType<Partial<T>>): void;
extend(options: TypeExtensionOptionsForType<unknown>): void;
}

interface TypeBasicOptions {
Expand Down

0 comments on commit e862d02

Please sign in to comment.