skonves / express-http-context

Get and set request-scoped context anywhere
MIT License
299 stars 26 forks source link

Feature request: need TypeScript typings for autocomplete #51

Open alexey2baranov opened 4 years ago

alexey2baranov commented 4 years ago

Pain

  1. In webstorm I can't use autoimport and have to import module manually.
  2. Even after manual import I can't use autocomplete for .middleware, .get and .set
ghost commented 3 years ago

Hey,

So... those are pretty minimal but they do the job:

import { NextFunction, Request, Response } from 'express'

export declare module 'express-http-context' {
  const middleware: (req: Request, res: Response, next: NextFunction) => void
  const get: <T>(key: string) => T
  const set: <T>(key: string, value: T) => void
}

edit: or here