adaltas / node-http-status

Utility to interact with HTTP status code in Node.js
Other
441 stars 55 forks source link

Typescript specific types #29

Closed osdiab closed 6 years ago

osdiab commented 6 years ago

For the TypeScript typings, instead of squashing types down to string or number, we already know the values are constant so provide those types directly.

This would be useful for me to narrow types for error handling in my APIs automatically and with fine-grained control. Thanks!

osdiab commented 6 years ago

I just tried it in my code by copy pasting the generated index.d.ts into the copy of index.d.ts in node_modules, and it works totally fine. Would appreciate it if this gets a prompt review :)

osdiab commented 6 years ago

cc @wdavidw

wdavidw commented 6 years ago

This make sense to me but consider that I'm no TS expert.