Natarajan Ganapathi
Natarajan Ganapathi

Reputation: 575

Can not promisifyAll Redis api with Bluebird in Typescript

I am unable to make Redis api to promisifyAll in typescript.

import * as redis from 'redis';
import {RedisClient} from 'redis';
import * as Promise  from 'bluebird';

Promise.promisifyAll(redis);
const client: RedisClient = redis.createClient(CacheConfig);

I am getting the following typescript error.

enter image description here

Upvotes: 1

Views: 1442

Answers (1)

basarat
basarat

Reputation: 275799

getting the following (tslint)error.

Stuff that mutates objects at runtime is not well supported by the TypeScript's (static) type system. PromisifyAll magically inserts new functions, but these new magic functions do not become a part of the existing interfaces (in this case RedisClient). You need to extend the RedisClient interface manually.

PS: Not a tslint error. Its a typescript error.

Upvotes: 2

Related Questions