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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update isHttpError return type #3

Merged
merged 1 commit into from Dec 20, 2023
Merged

fix: update isHttpError return type #3

merged 1 commit into from Dec 20, 2023

Conversation

princemuel
Copy link
Contributor

@princemuel princemuel commented Oct 31, 2023

Hi there! 馃憢馃徏 Please I'm using this package in one my projects and it's really nice.
I had an issue tho' where I'm doing this...

export function handleError<T extends unknown>(exception: T) {
  //  getting this error: Property 'expose' does not exist on type 'T'
  //  since the return type of the isHttpError function is boolean 
  //  not the more stricter HttpError which has the expose property
  if (isHttpError(exception) && exception.expose) { 

  }

and I'd like to contribute if you're open to it.

I replaced the return type of the isHttpError type guard with the type predicate error is HttpError instead of the looser boolean type.
This allows the error have the types of the HttpError class.

Signed-off-by: Prince Muel <vansomecsam@gmail.com>
@princemuel princemuel changed the title feat: update isHttpError return type fix: update isHttpError return type Oct 31, 2023
@codecov-commenter
Copy link

Welcome to Codecov 馃帀

Once merged to your default branch, Codecov will compare your coverage reports and display the results in this comment.

Thanks for integrating Codecov - We've got you covered 鈽傦笍

Copy link
Owner

@ShogunPanda ShogunPanda left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the long wait. This looks fine to me!

@ShogunPanda ShogunPanda merged commit dc5a2d2 into ShogunPanda:main Dec 20, 2023
3 checks passed
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.

None yet

3 participants