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

Update constructors.d.ts - allow optionally undefined ParsableDate #373

Merged

Conversation

9ParsonsB
Copy link
Contributor

currently, if you have a type that is one of the ParsableDate and optionally undefined, but not specifically a Date or undefined (i.e. Date | undefined) typescript will not allow the ParsableDate constructor as it does not allow undefined:

setDate(date?: string) {
  const st = spacetime(date)
}

No overload matches this call.
The last overload gave the following error.
Argument of type 'string | undefined' is not assignable to parameter of type 'ParsableDate'.

This PR removes one of the constructors (that is already covered by the ParsableDate constructor), and allows ParsableDate to be undefined

@spencermountain
Copy link
Owner

thank you!

@spencermountain spencermountain merged commit c2dd36e into spencermountain:master Feb 13, 2023
@spencermountain spencermountain mentioned this pull request Mar 30, 2023
Merged
@spencermountain
Copy link
Owner

released in 7.4.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.

2 participants