node-liquibase icon indicating copy to clipboard operation
node-liquibase copied to clipboard

'await' has no effect on the type of this expression.ts(80007)

Open rastitalabani opened this issue 3 years ago • 3 comments

Context

Hello, I'm using nodejs and typescript, await doesn't to have effect on neither of await liquibase.update({}); await liquibase.status();

Node-Liquibase Version

4.1.1

Liquibase Version (if not bundled)

Description

[Description of the bug or feature]

Steps to Reproduce

use your example code with nodejs and typscript you should see a warning in vscode on the following line

await instance.status();

Expected behavior: [What you expected to happen]

without await I wont be able to control the sequence of commands execution

Actual behavior: [What actually happened]

rastitalabani avatar Jun 25 '21 22:06 rastitalabani

Hey @rastitalabani, I see your expected behavior in the issue that you've opened, but I don't see what actually happens. Can you let us know what the current behavior is when using await with .update() and .status(), and what you'd expect to see happe?

Thanks! 🚀

tabuckner avatar Nov 09 '21 15:11 tabuckner

Hi,

I believe I have the same issue and can provide some context.

First of all, the example in the readme contains await update, giving the impression that it is supported/required.

As for the behaviour, I want to stop the script executing until Liquibase has completed, and this is done in Typescript with async/await. We run liquibase on server start and dont serve requests until it has completed to avoid running queries that require an updated schema.

UPDATE: It seems since the update call returns the Liquibase instance, instead of the child-process Promise, await can not be used. As a workaround, I just call whatever update does manually, and it seems to work:

await (instance as any).run(LiquibaseCommands.Update, {});

mikonsaari-yepzon avatar Apr 06 '22 08:04 mikonsaari-yepzon

Is the fix for this in 7b7f72bc?

Mr-Duda avatar Apr 09 '24 15:04 Mr-Duda