Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding generic type for cookie-session session #63891

Open
IainMcHugh opened this issue Jan 12, 2023 · 0 comments
Open

Adding generic type for cookie-session session #63891

IainMcHugh opened this issue Jan 12, 2023 · 0 comments

Comments

@IainMcHugh
Copy link

RE:

interface CookieSessionObject {

Instead of having to override the types declaration file in order to correctly type cookie-session session, would a solution be to update CookieSessionObject type to:

type CookieSessionObject<T> = T & {
        /**
         * Is true if the session has been changed during the request.
         */
        isChanged?: boolean | undefined;

        /**
         * Is true if the session is new.
         */
        isNew?: boolean | undefined;

        /**
         * Determine if the session has been populated with data or is empty.
         */
        isPopulated?: boolean | undefined;
}

This generic could then be an optional parameter on the express Request type. Any thoughts on this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant