New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeScript error #4
Comments
Would you like to send a Pull Request to address this issue? Remember to add unit tests. |
I am not convinced this is an issue with the library. The fix should be in your code where you explicitly set the type. Might be wrong of course 🤔 Another example that works as well. import closeWithGrace, { CloseWithGraceAsyncCallback } from './index';
const callback: CloseWithGraceAsyncCallback =
async ({ err }) => {
if (err) {
}
};
const closeListeners = closeWithGrace(
{ delay: 500 },
callback
); |
When I have time I'll take a look at it. |
I think adding an const closeListeners = closeWithGrace(
{ delay: 500 },
async ({ err }) => {
if (err) {
fastify.log.error(err);
}
await fastify.close();
} as closeWithGrace.CloseWithGraceAsyncCallback,
); |
If you are the latest typescript and don't want to cast, here is a good excuse to use the const closeListeners = closeWithGrace({ delay: 500 }, async function ({ err }) {
if (err) {
app.log.error(err)
}
await app.close()
} satisfies CloseWithGraceAsyncCallback) |
A PR to fix this would be amazing |
Imported as Runtime I get an error: "closeWithGrace is not a function" |
@StepanMynarik would you be open to send a PR with fix? |
@kibertoad |
With
I get
This, fixes it
The text was updated successfully, but these errors were encountered: