kelektiv / node-cron

Cron for NodeJS.
MIT License
8.31k stars 617 forks source link

fix: allow callbacks to return a promise #733

Closed sheerlox closed 8 months ago

sheerlox commented 8 months ago

Description

this is a type-only change that allows callbacks to return a promise. this was already possible before migrating the codebase to TypeScript, but it wasn't reflected correctly in our typings.

Related Issue

N/A

Motivation and Context

while working on the @nestjs/schedule PR to upgrade to cron@3.x, I got a SonarLint warning about passing an async function to onTick.

How Has This Been Tested?

added test case with async onTick.

Screenshots (if appropriate):

image

Types of changes

Checklist:

ncb000gt commented 8 months ago

:tada: This PR is included in version 3.1.3 :tada:

The release is available on:

Your semantic-release bot :package::rocket: