Boom function like Boom.notFound etc... works perfectly when Error is passed as 1st argument but is not allowed in index.d.ts
Support plan
is this issue currently blocking your project? (yes/no): no
is this issue affecting a production system? (yes/no): yes
Context
node version: 14.18.0
module version with issue: 9.1.4
last module version without issue: ?
environment (e.g. node, browser, native): node
used with (e.g. hapi application, another framework, standalone, ...): Hapi app
any other relevant information:
What are you trying to achieve or the steps to reproduce?
When a resource is not found, I throw an NotFoundError then I return a 404.
// 2 ways:
// Normal way
const boomError = Boom.notFound(error.message, error); // Ts checker ok
// secret way
const boomError = Boom.notFound(error); // Ts checker fails but works fine + has better debug details
Boom function like Boom.notFound etc... works perfectly when Error is passed as 1st argument but is not allowed in index.d.ts
Support plan
Context
What are you trying to achieve or the steps to reproduce?
When a resource is not found, I throw an
NotFoundError
then I return a 404.I decided to use the second way, it works fine but it's not documented. Why? https://github.com/hapijs/boom/blob/88b0a415856fbe47ee4a90680ebd6a7e502ec60f/lib/index.js#L71-L90
What was the result you got?
TS2345: Argument of type 'Error' is not assignable to parameter of type 'string'.
What result did you expect?
No error from Typescript