Support non-promise function options in TypeScript
Summary
Hey folks, thanks for the library! This is a small change to the types, with no functional changes, which should hopefully make things a tiny bit cleaner for users.
These functions don't really need to be async but currently the types require that they are. For example, currently this is an invalid option:
onSignal: () => logger.info("signal received")
and instead you'd have to write:
onSignal: async () => logger.info("signal received")
which might trigger a linter error such as typescript-eslint's Async method 'onSignal' has no 'await' expression.
or
onSignal: () => {
logger.info("signal received")
return Promise.resolve()
}
which creates a promise for no reason other than to satisfy the types!
With this PR the types make it clear that you can actually just return nothing or, in the case of the health checks, return a value without using async/await or creating a promise.
Changelog
Update types to support non-promise function options