// ./typings/express/index.d.ts
declare namespace Express {
export interface Request {
token?: string
}
}
Example usage:
import * as express from 'express'
(req: express.Request, res: express.Response, next: express.NextFunction) => {
const foo = req.token
}
It does work if I compile directly (tsc -p .
), it does work in Visual Code, but when I try to run with ts-node
I always get:
error TS2339: Property 'token' does not exist on type 'Request'.
Any idea how can I make it work with ts-node?
Versions: ts-node@7.0.1
typescript@3.0.1