-
-
Notifications
You must be signed in to change notification settings - Fork 51
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have searched existing issues to ensure the feature has not already been requested
🚀 Feature Proposal
I'd like to type the data I put in and get out of the session.
Motivation
I don't like type-casting any on every session.get().
Example
// fastify-secure-session/index.d.ts
export interface Session {
// …
get<Key extends keyof SessionData>(key: Key): SessionData[Key] | undefined;
set<Key extends keyof SessionData>(key: Key, value: SessionData[Key] | undefined): void;
}
export interface SessionData {
[key: string]: any;
}# user code
declare module 'fastify-secure-session' {
interface SessionData {
codeVerifier: string;
tokenSet: TokenSet;
}
}Metadata
Metadata
Assignees
Labels
No labels