types: make DataSource.stop compatible with LB4

Change the return value of `DataSource.stop()` from `Promise<void>`
to `void | PromiseLike<void>` to avoid breaking existing LoopBack 4
applications, where DataSource subclasses are scaffolded with
`stop(): ValueOrPromise<void>`.

Signed-off-by: Miroslav Bajtoš <mbajtoss@gmail.com>
This commit is contained in:
Miroslav Bajtoš 2020-04-28 08:23:39 +02:00
parent 4c665cd6f7
commit 7292d206e5
No known key found for this signature in database
GPG Key ID: 6F2304BA9361C7E3
1 changed files with 4 additions and 1 deletions

View File

@ -288,7 +288,10 @@ export declare class DataSource extends EventEmitter {
disconnect(callback: Callback): void;
// Only promise variant, callback is intentionally not described.
stop(): Promise<void>;
// Note we must use `void | PromiseLike<void>` to avoid breaking
// existing LoopBack 4 applications.
// TODO(semver-major): change the return type to `Promise<void>`
stop(): void | PromiseLike<void>;
ping(): Promise<void>;
// legacy callback style