You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After upgrading @remix-run/node from version ^2.7.0 to ^2.14.0, I encountered a type mismatch issue when using createCookieSessionStorage with a custom session data type. The type mismatch occurs because the createCookieSessionStorage function expects a generic type that extends SessionData, but it does not allow restricting the generic to specific keys.
Steps to Reproduce
Define a custom session data type with specific keys:
The custom session data type should be compatible with the SessionData interface, and there should be no type mismatch.
Actual Behavior
A type mismatch error occurs:
Argument of type 'SessionStorage<{ customProperty?: boolean | undefined; }, { customProperty?: boolean | undefined; }>' is not assignable to parameter of type 'SessionStorage<SessionData, SessionData>'.
The types returned by 'getSession(...)' are incompatible between these types.
Type 'Promise<Session<{ customProperty?: boolean | undefined; }, { customProperty?: boolean | undefined; }>>' is not assignable to type 'Promise<Session<SessionData, SessionData>>'.
Type 'Session<{ customProperty?: boolean | undefined; }, { customProperty?: boolean | undefined; }>' is not assignable to type 'Session<SessionData, SessionData>'.
Types of property 'get' are incompatible.
Type '<Key extends "customProperty" >(name: Key) => (Key extends "customProperty" ? { customProperty?: boolean | undefined; }[Key] : undefined) | (Key extends "customProperty" ? { ...; ...' is not assignable to type '<Key extends string>(name: Key) => (Key extends string | number ? any : undefined) | (Key extends string | number ? any : undefined) | undefined'.
Types of parameters 'name' and 'name' are incompatible.
Type 'Key' is not assignable to type '"customProperty"'.
Type 'string' is not assignable to type '"customProperty"'.
The text was updated successfully, but these errors were encountered:
Reproduction
After upgrading
@remix-run/node
from version^2.7.0
to^2.14.0
, I encountered a type mismatch issue when usingcreateCookieSessionStorage
with a custom session data type. The type mismatch occurs because thecreateCookieSessionStorage
function expects a generic type that extendsSessionData
, but it does not allow restricting the generic to specific keys.Steps to Reproduce
System Info
Used Package Manager
npm
Expected Behavior
The custom session data type should be compatible with the SessionData interface, and there should be no type mismatch.
Actual Behavior
A type mismatch error occurs:
The text was updated successfully, but these errors were encountered: