8

テストの実行後にデータベースをリセットするために、次のエンドポイントを設定しています。

import { getConnection } from 'typeorm';
import express from 'express';
const router = express.Router();

const resetDatabase = async (): Promise<void> => {
  const connection = getConnection();
  await connection.dropDatabase();
  await connection.synchronize();
};

// typescript-eslint throws an error in the following route:
router.post('/reset', async (_request, response) => {
  await resetTestDatabase();
  response.status(204).end();
});

export default router;

asynctypescript-eslint エラーで下線が引かれているため、ルート全体Promise returned in function argument where a void return was expected.

アプリは完璧に動作しますが、より安全な実装を行うべきか、Eslint を無視/無効にするべきかはわかりません。そのコードの何が問題なのか、何か考えはありますか?

4

2 に答える 2