Skip to content

refactor: simplify CronJob and CronTime constructor overloads for timeZone/utcOffset exclusivity#1065

Open
ravvdevv wants to merge 1 commit into
kelektiv:mainfrom
ravvdevv:fix/constructor-exclusive-params
Open

refactor: simplify CronJob and CronTime constructor overloads for timeZone/utcOffset exclusivity#1065
ravvdevv wants to merge 1 commit into
kelektiv:mainfrom
ravvdevv:fix/constructor-exclusive-params

Conversation

@ravvdevv

Copy link
Copy Markdown

Summary

Removes redundant constructor overloads in CronJob and CronTime that used null types to enforce timeZone/utcOffset exclusivity at the signature level.

Problem

The type system already enforces exclusivity via the CronJobParams union type. The two constructor overloads (one with utcOffset?: null, one with timeZone?: null) made the runtime check at the implementation level dead code in one branch.

Changes

  • src/job.ts: Removed two constructor overload signatures, kept single implementation signature with proper CronJobParams types
  • src/time.ts: Same fix for CronTime constructor
  • Runtime exclusivity check preserved for JS users

Testing

  • All 161 existing tests pass
  • Build succeeds
  • No coverage regression

Fixes #704

…eZone/utcOffset exclusivity

Removes redundant constructor overloads that used null types to enforce
timeZone/utcOffset exclusivity. The type system already handles this via
the CronJobParams union type. The runtime check in the implementation
constructor was dead code in one overload. Single signature with proper
types is cleaner and the runtime check still works correctly for JS users.

Fixes kelektiv#704
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.

refactor runtime check & typings of exclusive parameters timeZone & utcOffset

1 participant