backend: Extend Express Request type to include session object with user and token properties
This commit is contained in:
parent
570c830f63
commit
5e1e418c13
13
backend/src/config/@types/express/index.d.ts
vendored
Normal file
13
backend/src/config/@types/express/index.d.ts
vendored
Normal file
@ -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;
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -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"],
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user