diff --git a/types/observer-mixin.d.ts b/types/observer-mixin.d.ts index 769a00bc5..6a020e6cd 100644 --- a/types/observer-mixin.d.ts +++ b/types/observer-mixin.d.ts @@ -5,7 +5,11 @@ import {Callback, PromiseOrVoid} from './common'; -export type Listener = (ctx: object, next: (err?: any) => void) => void; +export interface OperationHookContext { + [property: string]: any; +} + +export type Listener = (ctx: OperationHookContext, next: (err?: any) => void) => void; export interface ObserverMixin { /** diff --git a/types/persisted-model.d.ts b/types/persisted-model.d.ts index a5e1b5cb1..dd4af1ad8 100644 --- a/types/persisted-model.d.ts +++ b/types/persisted-model.d.ts @@ -5,6 +5,7 @@ import {Callback, Options, PromiseOrVoid} from './common'; import {ModelBase, ModelData} from './model'; +import {Listener} from './observer-mixin'; import {Filter, Where} from './query'; /** @@ -519,6 +520,10 @@ export declare class PersistedModel extends ModelBase { * @returns {String} The `id` property name */ static getIdName(): string; + + definePersistedModel(entityClass: T): PersistedModel; + + static observe(operation: string, handler: Listener): void; } export type PersistedModelClass = typeof PersistedModel;