mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
[@keyv/redis] Add types (#31809)
This commit is contained in:
committed by
Sheetal Nandi
parent
56f95b3526
commit
8492d9a89b
Vendored
+32
@@ -0,0 +1,32 @@
|
||||
// Type definitions for @keyv/redis 1.3
|
||||
// Project: https://github.com/lukechilds/keyv-redis
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { Store } from 'keyv';
|
||||
import { ClientOpts } from 'redis';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
export = KeyvRedis;
|
||||
|
||||
declare class KeyvRedis extends EventEmitter implements Store<string | undefined> {
|
||||
readonly ttlSupport: true;
|
||||
namespace?: string;
|
||||
|
||||
constructor(options?: KeyvRedis.Options);
|
||||
constructor(uri: string, options?: KeyvRedis.Options);
|
||||
|
||||
get(key: string): Promise<string | undefined>;
|
||||
set(key: string, value: string | undefined, ttl?: number): Promise<number>;
|
||||
delete(key: string): Promise<boolean>;
|
||||
clear(): Promise<void>;
|
||||
}
|
||||
|
||||
declare namespace KeyvRedis {
|
||||
interface Options extends ClientOpts {
|
||||
uri?: string;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
import Keyv = require('keyv');
|
||||
import KeyvRedis = require('@keyv/redis');
|
||||
|
||||
new Keyv('redis://user:pass@localhost:6379', { max_attempts: 1 });
|
||||
|
||||
new KeyvRedis({ uri: 'redis://user:pass@localhost:6379' });
|
||||
new KeyvRedis('redis://user:pass@localhost:6379', { max_attempts: 1 });
|
||||
new KeyvRedis('redis://user:pass@localhost:6379', {
|
||||
uri: 'redis://user:pass@localhost:6379',
|
||||
max_attempts: 1,
|
||||
});
|
||||
const redis = new KeyvRedis('redis://user:pass@localhost:6379');
|
||||
new Keyv({ store: redis });
|
||||
@@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"@keyv/redis": [
|
||||
"keyv__redis"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"keyv__redis-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user