node-liquibase
node-liquibase copied to clipboard
'await' has no effect on the type of this expression.ts(80007)
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]
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! 🚀
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, {});
Is the fix for this in 7b7f72bc?