With Record<string, unknown>, you get a type error if you use an interface:
interface SessionState {
id: string
}
const session = await createSession<SessionState>(req, res)
// Error:
// Type 'SessionState' does not satisfy the constraint 'Record<string, unknown>'.
// Index signature for type 'string' is missing in type 'SessionState'.ts(2344)
With
Record<string, unknown>
, you get a type error if you use an interface: