From f3f0360a95f4014e742a314fc9f48045863a27fe Mon Sep 17 00:00:00 2001 From: David Mehren Date: Tue, 23 Feb 2021 21:45:36 +0100 Subject: [PATCH] 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 --- types/express/index.d.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 types/express/index.d.ts diff --git a/types/express/index.d.ts b/types/express/index.d.ts new file mode 100644 index 000000000..13bbf4862 --- /dev/null +++ b/types/express/index.d.ts @@ -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; + } +}