diff --git a/src/lib/http/middleware/authenticate.ts b/src/lib/http/middleware/authenticate.ts index da21f707..19fcd267 100644 --- a/src/lib/http/middleware/authenticate.ts +++ b/src/lib/http/middleware/authenticate.ts @@ -26,3 +26,5 @@ export const authenticate: ExtendedMiddleware = async (ctx, next) => { return next(); }; + +export type AuthenticateState = { userId?: string }; diff --git a/src/types.d.ts b/src/types.d.ts index 0a804c86..c53b4b7d 100644 --- a/src/types.d.ts +++ b/src/types.d.ts @@ -1,8 +1,9 @@ import type Koa from 'koa'; import type Router from '@koa/router'; import type { DocsLinkContext } from './lib/http/middleware/docs-link.js'; +import type { AuthenticateState } from './lib/http/middleware/authenticate.js'; -export type CustomState = Koa.DefaultState & { userId?: string }; +export type CustomState = Koa.DefaultState & AuthenticateState; export type CustomContext = Koa.DefaultContext & DocsLinkContext; export type ExtendedContext = Router.RouterContext;