tj / connect-redis

Redis session store for Connect

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upgrade typedefs for ioredis to v5

ahkhanjani opened this issue · comments

This code:

import * as session from 'express-session';
import Redis from 'ioredis';
import connectRedis from 'connect-redis';

const redis = new Redis();
const RedisStore = connectRedis(session);

app.use(
  session({
    store: new RedisStore({ client: redis })
  })
);

Produces this error:

Type 'Redis' is not assignable to type 'Client'.
  Type 'Redis' is missing the following properties from type 'Cluster': nodes, rpushBuffer, lpushBuffer, hsetBuffer, and 2 more.ts(2322)
index.d.ts(28, 13): The expected type comes from property 'client' which is declared here on type 'RedisStoreOptions'

ioredis v5 uses built-in typedefs instead of @types/ioredis. Please consider upgrading.

Types for this project are not officially maintained, they are maintained by a third party so would need to be updated there.