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

feature: add UnknownError type guard #13

Open
hrajchert opened this issue May 16, 2019 · 1 comment
Open

feature: add UnknownError type guard #13

hrajchert opened this issue May 16, 2019 · 1 comment
Labels
good first issue Good for newcomers
Milestone

Comments

@hrajchert
Copy link
Contributor

Create a type guard isUnknownError to avoid relying on instanceOf which does not always work.

@hrajchert hrajchert added this to the Version 2.0 milestone May 16, 2019
@hrajchert
Copy link
Contributor Author

Basically this with docs and tests

function isUnknownError (error: any): error is UnknownError {
    return typeof error === 'object' && error.errorType === 'UnknownError';
}

@hrajchert hrajchert added the good first issue Good for newcomers label May 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

1 participant