Skip to content

Compression middleware causes TypeScript typing error #223

Closed
@rjray

Description

@rjray

Using Express and Compression in a TypeScript project, I see the following error in VS Code:

No overload matches this call.
  The last overload gave the following error.
    Argument of type 'RequestHandler<ParamsDictionary, any, any, ParsedQs, Record<string, any>>' is not assignable to parameter of type 'PathParams'.ts(2769)
index.d.ts(153, 5): The last overload is declared here.

Environment information

Version:

Platform:

Linux tremere 6.11.0-19-generic #19~24.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon Feb 17 11:51:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux

Node.js version:

v22.12.0

Any other relevant information:
This only surfaced a month or two ago, after not being an error. The application does actually work, with compression enabled (tested in an API test utility). It's just the erroneous error flag that is an issue.

What steps will reproduce the bug?

I have reproduced this on both the Linux system I am currently using, and on MacOS. The repo that is exhibiting this is rjray/smdb, specifically the server sub-project.

The app.ts file in which this occurs is attached (as app.ts.txt due to GH limitations).

app.ts.txt

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions