-
Notifications
You must be signed in to change notification settings - Fork 192
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
Make isBoom type definition laxer #275
Conversation
@cjihrig, @devinivy, @Nargonath, @lloydbenson, @nlf, @geek 👋 kind bump? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not a regular TS user but LGTM, let's see what other have to say about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a very sensible (and backwards compatible) change.
FYI, for TS, you could just use a obj instanceof Boom
check instead.
Especially useful in hapijs context, where request.response can be a Boom object. This change allows the TypeScript code to leverage isBoom() to check if request.response is a Boom object or not, without any noisy typecast.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
agreed, this looks totally reasonable and how i would expect things to function 👍
Especially useful in hapijs context, where request.response can be a
Boom object. This change allows the TypeScript code to leverage isBoom()
to check if request.response is a Boom object or not, without any noisy typecast.