Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

241
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda