Add custom express types

We add a custom User object into the request object. To be able to use
that object in a strongly-typed situation, we need to tell TypeScript
that it exists.

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-02-23 21:45:36 +01:00
parent 68fd375d95
commit cc010ddf2a
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3

13
types/express/index.d.ts vendored Normal file
View file

@ -0,0 +1,13 @@
/*
* SPDX-FileCopyrightText: 2021 The HedgeDoc developers (see AUTHORS file)
*
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { User} from '../../src/users/user.entity';
declare module 'express' {
export interface Request {
user?: User;
}
}