Skip to content
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

fix(types): improve type-safety for cron callback functions #266

Merged
merged 3 commits into from
Nov 16, 2024

Conversation

renejfc
Copy link

@renejfc renejfc commented Nov 16, 2024

About

This PR introduces better type safety for callback functions in the Cron implementation:

Summary

  • Adds a proper CronCallback type definition to explicitly type the callback function parameters and return value
  • Replaces generic Function type with the more specific CronCallback type
  • Introduces isCronCallback type guard to safely check callback types at runtime
  • Updates test to leverage improved typing
  • Maintains backward compatibility while providing better type inference

Checks

  • all tests passing
  • pre-commit task passing
  • docs for new definitions added

These changes help catch potential type-related issues at compile time and provide better IDE support.

Note: This is a type-safety improvement with no runtime behavior changes.

@Hexagon Hexagon changed the base branch from master to dev November 16, 2024 08:45
@renejfc
Copy link
Author

renejfc commented Nov 16, 2024

My mistake—I worked directly from the master branch. Thanks for taking care of it!

Also, please feel free to change/adjust as you see fit.

@Hexagon
Copy link
Owner

Hexagon commented Nov 16, 2024

LGTM

@Hexagon Hexagon merged commit e92ec11 into Hexagon:dev Nov 16, 2024
@Hexagon
Copy link
Owner

Hexagon commented Nov 16, 2024

Thanks 👍

@Hexagon
Copy link
Owner

Hexagon commented Nov 16, 2024

Released to npm dev channel through 9.0.1-dev.2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants