diff --git a/backend/src/config/@types/express/index.d.ts b/backend/src/config/@types/express/index.d.ts new file mode 100644 index 0000000..5cf4b31 --- /dev/null +++ b/backend/src/config/@types/express/index.d.ts @@ -0,0 +1,13 @@ +import { ClaimGrants } from 'livekit-server-sdk'; +import { User } from '@typings-ce'; + +// Override the Express Request type to include a session object with user and token properties +// This will allow controllers to access the user and token information from the request object in a type-safe manner +declare module 'express' { + interface Request { + session?: { + user?: User; + tokenClaims?: ClaimGrants; + }; + } +} diff --git a/backend/tsconfig.json b/backend/tsconfig.json index 5041c8a..9a2ebb1 100644 --- a/backend/tsconfig.json +++ b/backend/tsconfig.json @@ -15,7 +15,8 @@ "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */ "paths": { "@typings-ce": ["./src/typings/ce/index.ts"] - } + }, + "typeRoots": ["src/config/@types"] }, "include": ["src/**/*.ts", "index.ts"], "exclude": ["node_modules", "tests/**/*.ts", "tests/**/*.tsx"],