DefinitelyTyped/types/rate-limit-redis/rate-limit-redis-tests.ts
Austin Beer f4073ff58a
Make RedisStore a class and expose RedisStoreOptions in rate-l… (#43113)
* Expose RedisStoreOptions in rate-limit-redis

* Also refactor to expose RedisStore as a class instead of a variable

* Rename RedisStore.RedisStoreOptions to RedisStore.Options so it is less
redundant and is consistent with RateLimit.Options from
express-rate-limit.
2020-03-26 02:28:31 -07:00

39 lines
703 B
TypeScript

import { RedisClient } from 'redis';
import IORedis = require('ioredis');
import RedisStore from 'rate-limit-redis';
let store: RedisStore;
// $ExpectType RedisStore
store = new RedisStore();
// $ExpectType RedisStore
store = new RedisStore({
expiry: 1000,
});
// $ExpectType RedisStore
store = new RedisStore({
prefix: 'types',
});
// $ExpectType RedisStore
store = new RedisStore({
resetExpiryOnChange: false,
});
// $ExpectType RedisStore
store = new RedisStore({
client: new RedisClient({}),
});
// $ExpectType RedisStore
store = new RedisStore({
client: new IORedis({}),
});
// $ExpectType RedisStore
store = new RedisStore({
redisURL: 'redis://localhost:6379',
});