@tlaziuk, @kerol2r20
On pull request #20341 the type of the Context.session property was redefined from session.sessionProps to session.sessionProps | null to include null in order to compile under strict null checks.
On #22882 the type of Context.session was redefined to session.Session | undefined as part od a large overhaul. However, this goes against the session semantics as defined in the koa-session module, which still requires the session to be set to null when it is closed.
Setting it to undefined during execution causes an error to be logged on the server.
@saabi session.Session | void would be enough?
https://www.typescriptlang.org/docs/handbook/basic-types.html#void
No, | null is absolutely necessary otherwise you get a compilation error when strict null checks is enabled..
@tlaziuk https://github.com/koajs/session#destroying-a-session
Hi, I got error
"node_modules/@types/koa-session/index.d.ts(216,9): error TS2717: Subsequent property declarations must have the same type. Property 'session' must be of type 'Session', but here has type 'Session'."
v: 5.7.4
Getting this error with Version 5.7.4: node_modules/@types/koa-session/index.d.ts:216:9 - error TS2717: Subsequent property declarations must have the same type. Property 'session' must be of type 'Session | null', but here has type 'Session | null'.
Any hints?
Hi @olegklimakov and @beyerleinf.
Regarding the error message:
"Subsequent property declarations must have the same type. Property 'session' must be of type 'Session', but here has type 'Session'"
For what I could see, we get this error due to koa-redis using the outdated dependency koa-generic-session, instead of koa-session.
There's a PR open that potentially would fix the type mismatch: https://github.com/koajs/koa-redis/pull/46
Most helpful comment
Hi, I got error
"node_modules/@types/koa-session/index.d.ts(216,9): error TS2717: Subsequent property declarations must have the same type. Property 'session' must be of type 'Session', but here has type 'Session'."
v: 5.7.4