From 7292d206e5b7aa8c5b3912866df322806acb276e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20Bajto=C5=A1?= Date: Tue, 28 Apr 2020 08:23:39 +0200 Subject: [PATCH] types: make DataSource.stop compatible with LB4 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change the return value of `DataSource.stop()` from `Promise` to `void | PromiseLike` to avoid breaking existing LoopBack 4 applications, where DataSource subclasses are scaffolded with `stop(): ValueOrPromise`. Signed-off-by: Miroslav Bajtoš --- types/datasource.d.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/types/datasource.d.ts b/types/datasource.d.ts index 34228b7a..47673c5e 100644 --- a/types/datasource.d.ts +++ b/types/datasource.d.ts @@ -288,7 +288,10 @@ export declare class DataSource extends EventEmitter { disconnect(callback: Callback): void; // Only promise variant, callback is intentionally not described. - stop(): Promise; + // Note we must use `void | PromiseLike` to avoid breaking + // existing LoopBack 4 applications. + // TODO(semver-major): change the return type to `Promise` + stop(): void | PromiseLike; ping(): Promise; // legacy callback style