diff --git a/types/yar/index.d.ts b/types/yar/index.d.ts index 79d55c1138..8f09e2023d 100644 --- a/types/yar/index.d.ts +++ b/types/yar/index.d.ts @@ -105,12 +105,17 @@ declare namespace yar { * an optional function to create custom session IDs. * Must retun a string and have the signature function (request) where: * request - (optional) is the original request received from the client. + * Defaults to uuidv4 */ customSessionIDGenerator?(req: Request): string; }; } interface Yar { + /** + * Session id, see `customSessionIDGenerator`. + */ + readonly id: string; /** * clears the session and assigns a new session id. */ diff --git a/types/yar/yar-tests.ts b/types/yar/yar-tests.ts index 997b18f82b..c7e75e0a4b 100644 --- a/types/yar/yar-tests.ts +++ b/types/yar/yar-tests.ts @@ -18,7 +18,10 @@ async function boot() { method: 'get', handler(request: Request) { const example = request.yar.get('example'); - return example.key; + return { + id: request.yar.id, + key: example.key, + }; }, }); }