Abazhenov / express-async-handler

Async Error Handling Middleware for Express
572 stars 39 forks source link

TS typing for async handler function #18

Closed qqilihq closed 6 years ago

qqilihq commented 6 years ago

This adds TS type checks to the async handler function. This makes sure that:

  1. asyncHandler('foo') results in a compile error,
  2. for asyncHandler((req, res, next) => { … }), the req, res, and next arguments retain their typing (before this PR, they were just typed any, which defeats a great portion of the TS benefits)
Abazhenov commented 6 years ago

Thank you!