diff --git a/types/boom/boom-tests.ts b/types/boom/boom-tests.ts index f989128b4e..4d133b2545 100644 --- a/types/boom/boom-tests.ts +++ b/types/boom/boom-tests.ts @@ -144,6 +144,12 @@ const isBoomError = new Boom.Boom('test') Boom.isBoom(isBoomError); +const maybeBoom = new Boom.Boom('test'); +if(Boom.isBoom(maybeBoom)) { + // isBoom is a type guard that allows accessing these properties: + maybeBoom.output.headers; +} + // constructor const constructorError: Boom.Boom = new Boom.Boom('test'); diff --git a/types/boom/index.d.ts b/types/boom/index.d.ts index 89ca580561..ed48f181cf 100644 --- a/types/boom/index.d.ts +++ b/types/boom/index.d.ts @@ -86,7 +86,7 @@ declare namespace Boom { * Identifies whether an error is a Boom object. Same as calling instanceof Boom. * @param error the error object to identify. */ - export function isBoom(error: Error): boolean + export function isBoom(error: Error): error is Boom // 4xx /**