Merge pull request #36767 from overleaf/oa-express-types

[web] Express req/res/next types

GitOrigin-RevId: 30b4822e2ee55976331d049f8109f7098914973c
This commit is contained in:
Olzhas Askar
2026-09-17 12:02:38 +00:00
committed by Copybot
parent e9206d2b95
commit bb7dfcd588
14 changed files with 225 additions and 165 deletions
+7
View File
@@ -1,6 +1,7 @@
import 'express'
import OAuth2Server from '@node-oauth/oauth2-server'
import type SessionData from 'express-session'
import type { Capability } from '../../capabilities'
// Request-scoped logger attached by @overleaf/metrics http.monitor() middleware.
// See libraries/metrics/http.js RequestLogger class.
@@ -20,11 +21,17 @@ declare module 'express' {
oauth_user?: OAuth2Server.User
logger: RequestLogger
i18n: {
language: string
translate(
key: string,
vars?: Record<string, any>,
components?: any
): string
}
// Set by PermissionMiddleware
managedBy?: any
isManagedGroupAdmin?: boolean
capabilitySet?: Set<Capability>
assertPermission(capability: string): void
}
}
+13
View File
@@ -0,0 +1,13 @@
import 'express'
declare module 'express' {
// eslint-disable-next-line no-unused-vars
interface Response {
// Set per-request by the addSetContentDisposition middleware in
// app/src/infrastructure/ExpressLocals.mjs (web/private-api/public-api routers only).
setContentDisposition(
type: 'attachment' | 'inline',
opts: { filename: string }
): void
}
}