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

Ts fix #241

Merged
merged 3 commits into from Sep 20, 2019

Conversation

@kanongil
Copy link
Member

kanongil commented Sep 20, 2019

I changed the definition of the Boom type to use interfaces. This enables it to specify the return type of the constructor and merge the type with the decorator option.

Additionally, I made the data property optional to reflect the actual implementation.

@Marsup
Marsup approved these changes Sep 20, 2019
Copy link
Member

Marsup left a comment

Very well done.

@@ -81,15 +81,16 @@ declare namespace boom {
}
}

interface BoomConstructor {
new <Data = any, Decoration extends object = object>(message?: string | Error, options?: boom.Options<Data, Decoration>): Boom<Data> & Decoration;

This comment has been minimized.

Copy link
@Marsup

Marsup Sep 20, 2019

Member

While working on this I was wondering whether we should default on generic parameters, I'm not sure it's that useful.

This comment has been minimized.

Copy link
@kanongil

kanongil Sep 20, 2019

Author Member

I don't know, really. I just tried to copy it as-is, though I added extends object to signal that it only works with objects.

@hueniverse hueniverse merged commit f736e89 into hapijs:master Sep 20, 2019
1 check was pending
1 check was pending
continuous-integration/travis-ci/pr The Travis CI build is in progress
Details
@hueniverse hueniverse self-assigned this Sep 20, 2019
@hueniverse hueniverse added the types label Sep 20, 2019
@hueniverse hueniverse added this to the 7.4.8 milestone Sep 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.