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: fix object constructor typings & make OC generic type optional #712

Merged

Conversation

sheerlox
Copy link
Collaborator

Description

the generic typings on the CronJob.from() method were not up-to-date with CronJob's typings, this PR updates them.

while working on this, I attributed a default to the OC generic parameter to improve usage convenience (that was previously bugging out the TypeScript compiler type's inference).

we might want to consider substituting the generic place since users will need to type C more often than OC, but that would imply releasing a new major version, so we can probably leave it as is for now since we can do CronJob<CronOnCompleteCommand, { key: 'value' } to type both context and onComplete, or CronJob<null, { key: 'value' } to omit onComplete.

Related Issue

Discord thread: "How to trigger onComplete?"

Motivation and Context

  • incorrect typing of the CronJob.from() method
  • the OC generic type parameter could be optional

How Has This Been Tested?

  • added test case
  • updated existing test case
  • live testing with a test-dedicated project while developing

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.
  • If my change introduces a breaking change, I have added a ! after the type/scope in the title (see the Conventional Commits standard).

@sheerlox sheerlox requested a review from intcreator October 11, 2023 13:01
@sheerlox sheerlox self-assigned this Oct 11, 2023
@sheerlox sheerlox added the type:bug Bug reports and bug fixes label Oct 11, 2023
@sheerlox sheerlox changed the title fix: fix object constructor generic types fix: fix object constructor typings & make OC generic type optional Oct 11, 2023
@sheerlox sheerlox merged commit 6536084 into kelektiv:main Oct 12, 2023
11 checks passed
@sheerlox sheerlox deleted the fix/onComplete-generic-from-constructor branch October 12, 2023 22:35
ncb000gt pushed a commit that referenced this pull request Oct 12, 2023
## [3.1.1](v3.1.0...v3.1.1) (2023-10-12)

### 🐛 Bug Fixes

* fix lastDate() value for intervals > 25 days ([#711](#711)) ([141aa00](141aa00))
* fix object constructor typings & make OC generic type optional ([#712](#712)) ([6536084](6536084))

### 📚 Documentation

* **readme:** update nextDates documentation ([#702](#702)) ([1ad2e22](1ad2e22))
@ncb000gt
Copy link
Member

🎉 This PR is included in version 3.1.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@sheerlox sheerlox removed their assignment Oct 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
released type:bug Bug reports and bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants