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 · 5 comments
Closed

Typescript - can't extend Boom #244

ondratra opened this issue Sep 22, 2019 · 5 comments
Assignees
Labels
bug Bug or defect types TypeScript type definitions
Milestone

Comments

@ondratra
Copy link

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
Copy link
Contributor

Marsup commented Sep 22, 2019

Have you tried 7.4.9 ?

@ondratra
Copy link
Author

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

@hueniverse hueniverse self-assigned this Sep 23, 2019
@hueniverse hueniverse added bug Bug or defect types TypeScript type definitions labels Sep 23, 2019
@dgreene1
Copy link

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
Copy link

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
@lock
Copy link

lock bot commented Jan 9, 2020

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 9, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Bug or defect types TypeScript type definitions
Projects
None yet
Development

No branches or pull requests

4 participants