koa-session: flesh out types for `beforeSave` and `valid` hooks (#18789)
koa-session: flesh out types for `beforeSave` and `valid` hooks (#18789)

* koa-session: make `beforeSave` hook optional

https://github.com/koajs/session/blob/ec88cfb095ddbfa9a0db465e3f9e459fb6f92bec/lib/context.js#L215-L218

* Flesh out types for beforeSave

* add proper types for valid() as well

zuzusik/DefinitelyTyped,rolandzwaga/DefinitelyTyped,AgentME/DefinitelyTyped,alexdresko/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,georgemarshall/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,jimthedev/DefinitelyTyped,laurentiustamate94/DefinitelyTyped,zuzusik/DefinitelyTyped,mcliment/DefinitelyTyped,borisyankov/DefinitelyTyped,georgemarshall/DefinitelyTyped,jimthedev/DefinitelyTyped,ashwinr/DefinitelyTyped,nycdotnet/DefinitelyTyped,chrootsu/DefinitelyTyped,minodisk/DefinitelyTyped,arusakov/DefinitelyTyped,ashwinr/DefinitelyTyped,arusakov/DefinitelyTyped,abbasmhd/DefinitelyTyped,magny/DefinitelyTyped,one-pieces/DefinitelyTyped,georgemarshall/DefinitelyTyped,aciccarello/DefinitelyTyped,markogresak/DefinitelyTyped,arusakov/DefinitelyTyped,chrootsu/DefinitelyTyped,abbasmhd/DefinitelyTyped,benishouga/DefinitelyTyped,borisyankov/DefinitelyTyped,benishouga/DefinitelyTyped,georgemarshall/DefinitelyTyped,jimthedev/DefinitelyTyped,minodisk/DefinitelyTyped,dsebastien/DefinitelyTyped,AgentME/DefinitelyTyped,benishouga/DefinitelyTyped,AgentME/DefinitelyTyped,AgentME/DefinitelyTyped,magny/DefinitelyTyped,aciccarello/DefinitelyTyped,alexdresko/DefinitelyTyped,benliddicott/DefinitelyTyped,dsebastien/DefinitelyTyped,aciccarello/DefinitelyTyped,zuzusik/DefinitelyTyped,AbraaoAlves/DefinitelyTyped,rolandzwaga/DefinitelyTyped,nycdotnet/DefinitelyTyped