Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

242
Views
Can't get Express @types working

I'm trying to get the Express @types working but without any success. I'm using Visual Studio Code and I'd really love to have the autocompletition working. So far I've seen that installing the @types it gives the autocompletition too.

Things that I've done:
Installed express with npm: npm i -g express
Installed express-generator with npm: npm i -g express-generator
Generated the project with express-generator
cd into the project
Ran npm i
Installed types with npm: npm i --save-dev @types/express

// Top of the file: var express = require('express');

app.use(function (req, res: Express.Response, next) {
    var err: any = new Error('Not Found');

    //if I try to use res.end() it gets underlined in red
    res.end('some text');
});

As you can see the Express.Response was suggested by vscode, so this kinda confuses me. How can you find the Express.Response type but not it's methods?

The 'funny' fact is that in plain js everything works. Am I missing something or doing something wrong?

Here's my tsconfig.json file if it can help:

{
    "compileOnSave": false,
    "compilerOptions": {
        "outDir": "./dist/out-tsc",
        "baseUrl": "src",
        "sourceMap": true,
        "declaration": false,
        "moduleResolution": "node",
        "emitDecoratorMetadata": true,
        "experimentalDecorators": true,
        "target": "es5",
        "lib": [
            "es2016",
            "dom"
        ]
    }
}

Any help will be really appreciated!

about 4 years ago · Santiago Trujillo
1 answers
Answer question

0

Solved by myself

For some reason now import * as express from 'express' now gives me the correct completition and type checking. However trying this before didn't worked. That's odd, however closing it as solved.

about 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!