Skip to content

evlogErrorHandler has invalid type signature in TanStack Start server middleware #235

@hanneswidrig

Description

@hanneswidrig

Description

The middleware appears to work but TypeScript is unhappy with the function signature. Related to this original issue #137.

[createMiddleware().server(evlogErrorHandler)]

Argument of type '<T>(nextOrOptions: ((...args: any[]) => Promise<T>) | { next: (...args: any[]) => Promise<T>; }) => Promise<T>' is not assignable to parameter of type 'RequestServerFn<{}, undefined, unknown>'.
  Types of parameters 'nextOrOptions' and 'options' are incompatible.
    Type 'RequestServerOptions<{}, undefined>' is not assignable to type '((...args: any[]) => Promise<RequestServerResult<{}, undefined, unknown>>) | { next: (...args: any[]) => Promise<RequestServerResult<{}, undefined, unknown>>; }'.
      Type 'RequestServerOptions<{}, undefined>' is not assignable to type '{ next: (...args: any[]) => Promise<RequestServerResult<{}, undefined, unknown>>; }'.
        The types returned by 'next(...)' are incompatible between these types.
          Type 'RequestServerNextFnResult<{}, undefined, unknown>' is not assignable to type 'Promise<RequestServerResult<{}, undefined, unknown>>'.
            Type 'RequestServerResult<{}, undefined, unknown>' is missing the following properties from type 'Promise<RequestServerResult<{}, undefined, unknown>>': then, catch, finally, [Symbol.toStringTag]

Reproduction

https://stackblitz.com/edit/github-agzk935e?file=src%2Froutes%2F__root.tsx&view=editor

Logs

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions