Closed abbasogaji closed 4 years ago
Hi @abbasogaji can you provide some more details about where you are seeing this error + a minimal reproduceable example?
This looks likely to be a type error because the Opine Request
type on the req
object doesn’t allow arbitrary properties - if you wish to extend the object with your own properties then I would expect that you define your own type that extends the Opine Request
type. Alternatively if you are not interested in using types you can use Opine in pure JavaScript files.
If you are looking to store properties and pass them between middleware, the recommended way is to use the res.locals
object. Please see the docs —> https://github.com/asos-craigmorten/opine/blob/main/.github/API/response.md#reslocals
Issue
Can't assign new properties to "req" Setup:
For example; req.user (throws an error since Property 'user' does not exist on type 'Request<ParamsDictionary, any, any>')
Details