1

How do I extend the type of express to accommodate my custom attribute?

import * as express from 'express';
const e = express();
e.config = {};

t.ts(3,3): error TS2339: Property 'config' does not exist on type 'Express'.

Kevin Tew
  • 11
  • 1
  • Possible duplicate of [How to extends class from other js file without declaration file](https://stackoverflow.com/questions/44857128/how-to-extends-class-from-other-js-file-without-declaration-file) – try-catch-finally Jul 22 '17 at 16:21
  • Is duplicated. At least to: [How to extends class from other js file without declaration file](https://stackoverflow.com/questions/44857128/how-to-extends-class-from-other-js-file-without-declaration-file) and [Typescript Error: Property 'user' does not exist on type 'Request'](https://stackoverflow.com/questions/44383387/typescript-error-property-user-does-not-exist-on-type-request) (Both reference TS2339). [Other search results](https://stackoverflow.com/search?q=is%3Aquestion+%5Bnode.js%5D+TS2339) – try-catch-finally Jul 22 '17 at 16:23
  • I would like to see how to do this with module/global augmentation This example code doesn't work in my .ts files, should I be putting it somewhere else? declare module Express { export interface Request { user: any } } – Kevin Tew Jul 31 '17 at 08:14

0 Answers0