I have the following endpoint setup to reset a database after test runs:
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;
The entire route since async
is underlined with a typescript-eslint error Promise returned in function argument where a void return was expected.
The app works perfectly but I'm not sure if I should be doing a safer implementation or just ignoring/disabling Eslint for this one. Any idea of what's wrong with that code?