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

Typescript - can't extend Boom #244

Closed
ondratra opened this issue Sep 22, 2019 · 4 comments
Assignees
Labels
Milestone

Comments

@ondratra
Copy link

@ondratra ondratra commented Sep 22, 2019

Hi,
in version @hapi/boom v7.4.2 I was able to extend Boom class like this:

import * as Boom from '@hapi/boom'

export class RequestError extends Boom {

}

and use my custom error in the project. But after version 7.4.3 it can't be done anymore. First of all I need to import in a slightly different way and then I get error.
So in 7.4.3 with this code

import Boom from '@hapi/boom'
// import {Boom} from '@hapi/boom' // is also fine

export class RequestError extends Boom {

}

I get error TypeError: Object prototype may only be an Object or null: undefined

Is it bug or intended feature? If so how to achieve the same effect?

@Marsup

This comment has been minimized.

Copy link
Member

@Marsup Marsup commented Sep 22, 2019

Have you tried 7.4.9 ?

@ondratra

This comment has been minimized.

Copy link
Author

@ondratra ondratra commented Sep 23, 2019

Yes, sry I haven't mentioned it right away. Does it work for you?

@hueniverse hueniverse self-assigned this Sep 23, 2019
@dgreene1

This comment has been minimized.

Copy link

@dgreene1 dgreene1 commented Sep 23, 2019

We're seeing a similar error in 7.4.9 where Boom is undefined when we import is as such:

import Boom from '@hapi/boom';

Boom.isBoom(error)

The actual runtime error is: Cannot read property 'isBoom' of undefined

@dgreene1

This comment has been minimized.

Copy link

@dgreene1 dgreene1 commented Sep 23, 2019

Update: it looks like the commit that caused my above issue is feb25bf by @hueniverse

cc'ing @el-besto

hueniverse added a commit that referenced this issue Sep 23, 2019
Marsup added a commit that referenced this issue Sep 23, 2019
@hueniverse hueniverse added this to the 7.4.10 milestone Sep 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.