tinyhttp: Incompatible with Express middleware: `express.Handler`

Describe the bug

I am attempting to use the @bufbuild/connect-express middleware. The middleware has the following signature:

export declare function expressConnectMiddleware(options: ExpressConnectMiddlewareOptions): express.Handler;

To Reproduce

Steps to reproduce the behavior:

import { expressConnectMiddleware } from "@bufbuild/connect-express";
import { App } from "@tinyhttp/app";

const app = new App();

app
  .use(
    expressConnectMiddleware({
    }),
  )

Versions

  • node: 20
  • @tinyhttp/app: 2.0.32

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 26 (20 by maintainers)

Most upvoted comments

Argument of type 'Handler' is not assignable to parameter of type 'App<any, Request, Response<any, any>> | RouterPathOrHandler<Request, Response<any, any>>'.
  Type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is not assignable to type 'AsyncHandler<Request, Response<any, any>>'.
    Types of parameters 'req' and 'req' are incompatible.
      Type 'Request' is missing the following properties from type 'Request<ParamsDictionary, any, any, ParsedQs, Record<string, any>>': header, accepted, param, host, baseUrl

Most pertinent bit I found: RequestHandler is not assignable to AsyncHandler