blakeembrey / blakeembrey/compose-middleware

Type 'Next<void>' is not assignable to type 'NextFunction'

Open
#24 7 comments 4 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
90
Forks
9
PR merge metrics
No merged PRs in 30d

Description

I am using Typescript v4.0.2 and I am getting a type error when trying to use third party middleware that uses the NextFunction type from @types/express.

Culprit code:
```typescript
// Next & NextFunction are not compatable and no way to overwrite with generic
type Next = (err?: Error | null) => T;

type RequestHandler = (req: T, res: U, next: Next) => V;
```

I recommend something like:
```typescript
type RequestHandler = (req: TRequest, res: TResponse, next: TNext) => TReturn;
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.