Skip to content

[BUG] client useAdapter from @type-cacheable/redis-adapter not compatible with redis > 4.1 #1280

@herebebogans

Description

@herebebogans

For the example in the README.md for type-cacheable/redis-adapter

import Redis from 'redis';
import { useAdapter } from '@type-cacheable/redis-adapter';

const client = Redis.createClient();
const clientAdapter = useAdapter(client);

the typings in redis > 4.1 are incompatible

..... 
Type 'RedisFunctions' is not assignable to type 'Record<string, never>'.
            'string' index signatures are incompatible.
              Type 'RedisFunctionLibrary' is not assignable to type 'never'.t

It can be fixed with

import type { RedisClientType } from 'redis';
....
const client = Redis.createClient() as RedisClientType<any>;

Not sure if this is the best way though.

If you remove the "@types/redis": "^4.0.11", in redis-adapter/package.json (redis provided it's own typings) - should see the same inssue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions