expressjs / expressjs/express

Typings for Send accept a Promise but the function doesn't await it

Open
#6,385 3 comments 0 reactions 0 assignees View on GitHub
typescript
Dominant language
JavaScript
Stars
69.5k
Forks
25k
Avg merge
4d 20h
Merged PRs (30d)
9

Description

## Environment information

**Version**: 5.0.1 (latest)
**Platform**: Windows 10 (x86_64)
**Node.js version**: 22.14.0
**TypeScript version**: 5.5.4

## What steps will reproduce the bug?

```ts
const getData = async (): Promise> => {
return { hello: "world" };
};

router.get("/test", (_req, res) => {
res.json(getData());
});
```

This compiles successfully but the response will be `{}`.

I expected either a compiler error or for the response to be `{"hello":"world"}`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.