You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 wayconstboomError=Boom.notFound(error.message,error);// Ts checker ok// secret wayconstboomError=Boom.notFound(error);// Ts checker fails but works fine + has better debug details
I decided to use the second way, it works fine but it's not documented. Why?
kanongil
changed the title
Boom function like Boom.notFound etc... works perfectly when Error is passed as 1st argument but is not allowed in index.d.ts
Missing Boom.notFound etc error argument type support
May 2, 2022
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?
boom/lib/index.js
Lines 71 to 90 in 88b0a41
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
The text was updated successfully, but these errors were encountered: