Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@types/response-time #28849

Closed
ghost opened this issue Sep 13, 2018 · 0 comments
Closed

@types/response-time #28849

ghost opened this issue Sep 13, 2018 · 0 comments

Comments

@ghost
Copy link

ghost commented Sep 13, 2018

I am able to import the package however i have a problem when using it. The following package does not have typescript support for the specific function responseTime(fn)

expressjs/response-time#13

Currently

app.use(responseTime(function (req, res, time) {

Expected

app.use(responseTime((req: Request, res: Response, time: any) => {

However it shows me an error

[ts]
Argument of type '(req: Request, res: Response, time: any) => void' is not assignable to parameter of type 'ResponseTimeFunction'.
Types of parameters 'req' and 'request' are incompatible.
Type 'IncomingMessage' is not assignable to type 'Request'.
Property 'get' is missing in type 'IncomingMessage'.
(alias) interface Request
import Request

src/app.ts:101:35 - error TS2345: Argument of type '(req: Request, res: Response, time: any) => void' is not assignable to parameter of type 'ResponseTimeFunction'.
Types of parameters 'req' and 'request' are incompatible.
Type 'IncomingMessage' is not assignable to type 'Request'.
Property 'get' is missing in type 'IncomingMessage'.

101 this.app.use(responseTime((req: Request, res: Response, time: any) => {
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

0 participants