Skip to content

Use the right type for the ValidationError constructor #68

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

Merged
merged 1 commit into from
Feb 6, 2021

Conversation

NGTOne
Copy link
Contributor

@NGTOne NGTOne commented Feb 6, 2021

The current ValidationError constructor definition is inherited from the base Error, which gives it a signature of constructor(message?: string, fileName?: string, lineNumber?: string). This is at odds with the actual definition and use of ValidationError, which means TypeScript consumers of this library that wish to use this error themselves must currently work around the issue like so:

throw new ValidationError({body: errors} as any);

@codecov
Copy link

codecov bot commented Feb 6, 2021

Codecov Report

Merging #68 (a29980b) into master (4c162aa) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##            master       #68   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            1         1           
  Lines           26        26           
=========================================
  Hits            26        26           

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4c162aa...a29980b. Read the comment docs.

@simonplend simonplend self-requested a review February 6, 2021 09:36
@simonplend simonplend added this to the Release v2.2.0 milestone Feb 6, 2021
@simonplend
Copy link
Collaborator

Thank you so much for this pull request, I really appreciate it.

I'll be including this fix in the next release, which I hope to get out within the next couple of weeks.

@simonplend simonplend merged commit 57f0d57 into vacekj:master Feb 6, 2021
@NGTOne NGTOne deleted the types-for-validation-error branch February 9, 2021 12:41
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