From 5539fb2bee2f491e329f576f1f6df38055edbd43 Mon Sep 17 00:00:00 2001 From: Margus Lamp Date: Tue, 5 Dec 2017 10:42:50 +0200 Subject: [PATCH] umzug being EventEmitter, added appropriate events --- types/umzug/index.d.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/types/umzug/index.d.ts b/types/umzug/index.d.ts index 634c247bd4..9f2602f361 100644 --- a/types/umzug/index.d.ts +++ b/types/umzug/index.d.ts @@ -1,9 +1,11 @@ -// Type definitions for Umzug v2.0.1 +// Type definitions for Umzug v2.1.0 // Project: https://github.com/sequelize/umzug // Definitions by: Ivan Drinchev +// Margus Lamp // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.3 +import { EventEmitter } from 'events'; import Sequelize = require("sequelize"); declare namespace umzug { @@ -169,7 +171,7 @@ declare namespace umzug { file: string; } - interface Umzug { + interface Umzug extends EventEmitter { /** * The execute method is a general purpose function that runs for * every specified migrations the respective function. @@ -200,6 +202,10 @@ declare namespace umzug { down(migrations?: string[]): Promise; down(options?: DownToOptions | UpDownMigrationsOptions): Promise; + on(eventName: 'migrating' | 'reverting' | 'migrated' | 'reverted', cb?: (name: string, migration: string) => void): this; + addListener(eventName: 'migrating' | 'reverting' | 'migrated' | 'reverted', cb?: (name: string, migration: string) => void): this; + removeListener(eventName: 'migrating' | 'reverting' | 'migrated' | 'reverted', cb?: (name: string, migration: string) => void): this; + } interface UmzugStatic { @@ -207,5 +213,5 @@ declare namespace umzug { } } -declare var umzug: umzug.UmzugStatic; +declare const umzug: umzug.UmzugStatic; export = umzug;