While people have asked similar questions, none of those answers are solving my problem. I'm in TypeScript 2.9.2 and I'm trying to add a context object to the Express Request object. I want to do it in a .d.ts
file.
What I currently have is this:
express.d.ts
declare namespace Express {
interface Request {
context: any;
}
}
However, it won't compile because `Property 'context' does not exist on type 'Request'.
In my other files, Webstorm claims the Request type is getting imported from the proper file.
I was under the impression that I could take advantage of declaration merging and not have to import or export a type definition.
Is this incorrect?