Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

"No overload matches this call" using cookieParser with Express 5 and Typescript

オープン
#138 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
45/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
領域
backend

調査の方向性

まず、Express 5 と TypeScript で報告された app.use(cookieParser()) の呼び出しを再現し、その後 cookie-parser の型宣言と、そのエントリーポイントが想定する Express 5 のミドルウェア型を調べます。完了条件は、any キャストなしで例の型チェックが通り、既存のパッケージチェックも引き続き通ることです。

索引モデルが issue の本文から書いたものです。

説明

bug

Environment information

Version:

"dependencies": {
 "cookie-parser": "^1.4.7",
 "express": "^5.1.0",
}

Platform:
Windows 11

Node.js version:
v20.15.1

Bug

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(157, 5): The last overload is declared here.

What steps will reproduce the bug?

Write the following code...

import cookieParser from 'cookie-parser';
import express, {Application} from 'express';

const app: Application = express();
app.use(cookieParser());

The error is caused by Express 5 being more strict with Typescript and wanting return void. You can no longer return anything from your middleware. I've had to replace all code like

return res.status(200);

with

res.status(200);
return // or just get rid of return completely

The only workaround I've found is the following...

app.use(cookieParser() as any);

which is a last resort when using Typescript, as it completely turns off all Typescript type checking.

You need to update this package to work properly with Express 5.

主要言語
JavaScript
スター
2k
フォーク
235
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

expressjs/cookie-parser のほかの issue

expressjs/cookie-parser の issue をすべて見る

似ている issue

JavaScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。