Updated from dt/express-serve-static-core#0.0.0+20160701212727 to dt/express-serve-static-core#4.0.0+20160715232503.
Can no longer add a router as middleware without getting an intellisense argument type mismatch error in WebStorm, i.e.,
server.use('/app', express.Router());
This was fine with previous definition file.
@blakeembrey ?
The express server router docs document that we can add a router as follows:
app.use('/app', router);
prior to the dt/express-serve-static-core#4.0.0+20160715232503 release it was possible to implement this method in typescript in a sematically identical manner. However, I don't seem to be able to do this with the latest release without getting an intellisense error. Looking at the changeset (1e92c152ee1b7af9b39f01789de37e2e463fd0de - enhance IRouter), the method declaration for use has been removed.
Being new to typescript, I'm probably not using it correctly. However, I would have thought the definition files should follow the release docs of the api as closely as possible. Wondering how to properly use use with routers in latest release.
@vvakame It's still a DefinitelyTyped issue from the looks of it. All it means is they updated from the version that was from July 01 to July 15. A change in those versions has broken his code. It looks like maybe the use definition change is faulty?
Any news on this?
I would send PR for that, but I'm new to typescript and express
It looks like maybe the use definition change is faulty?
To me, this happens with the routes as well, not only middlewares:

Anyone running into this from DefinitelyTyped, the only thing I can recommend is using the definition from @types instead. I don't contribute directly to DefinitelyTyped because it results in a loss of ownership over definitions, and a loss of ownership results in a loss of future meaningful maintainership. Ignoring that, if you're installing with Typings you can just do typings install express to install the NPM version from @types (non-global).
I'm actually using @types/[email protected].
I came here because it seems to be the same problem as I'm having, and as far as I'm aware... @types packages are published from DefinitelyTyped types-2.0 branch.
No, they are not. @types is a GitHub organisation, you're using NPM (which is from DefinitelyTyped). If you're using @types on NPM, you'll just have to wait until someone patches it here and publishes it to NPM for you. Here's the Express.js definition authored by contributors of Typings - https://github.com/types/npm-express. I definitely was not trying to recommend you use the same definition you say you're having issues with 馃槃
Most helpful comment
No, they are not. @types is a GitHub organisation, you're using NPM (which is from DefinitelyTyped). If you're using
@typeson NPM, you'll just have to wait until someone patches it here and publishes it to NPM for you. Here's the Express.js definition authored by contributors of Typings - https://github.com/types/npm-express. I definitely was not trying to recommend you use the same definition you say you're having issues with 馃槃