DEV Community

Discussion on: Extending Express' Types with TypeScript Declaration Merging - TypeScript 4

Collapse
 
philipphock profile image
philipphock

This is very short and easily explained, but where do you save this. You can, of course, write it in every file you are using a session, but obviously that's not how you would do it. You probably want to use some sort of d.ts file. Could you explain how to use them properly.

Collapse
 
actlikewill profile image
Wilson

Hello did you figure this out? I have the same issue. I added a @types file at the root of my project with a global.d.types file. in there I added the above code. I also updated my tsconfig.json typeRoots entry to point to the above folder as well as node modules type folder. Within the editor I see that the types are being recognised but the compiler keeps throwing an error.
Did you make any progress on this? Any help is appreciated.

Collapse
 
otobot1 profile image
otobot1

Did you ever figure this out? I'm having the same problem.