mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-20 12:46:36 +08:00
Add koa-redis type definitions (#16179)
This commit is contained in:
committed by
Sheetal Nandi
parent
038ab80ad1
commit
ffa30397c2
17
types/koa-redis/index.d.ts
vendored
Normal file
17
types/koa-redis/index.d.ts
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
// Type definitions for koa-redis 3.0
|
||||
// Project: https://github.com/koajs/koa-redis
|
||||
// Definitions by: Nick Simmons <https://github.com/nsimmons>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import {ClientOpts} from 'redis';
|
||||
import {SessionStore} from 'koa-generic-session';
|
||||
|
||||
declare namespace redisStore {
|
||||
interface RedisOptions extends ClientOpts {
|
||||
duplicate?: boolean;
|
||||
client?: any;
|
||||
}
|
||||
}
|
||||
|
||||
declare function redisStore(options: redisStore.RedisOptions): SessionStore;
|
||||
export = redisStore;
|
||||
20
types/koa-redis/koa-redis-tests.ts
Normal file
20
types/koa-redis/koa-redis-tests.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import * as Koa from "koa";
|
||||
import {MemoryStore, Session} from "koa-generic-session";
|
||||
import session = require("koa-generic-session");
|
||||
import redisStore = require("koa-redis");
|
||||
|
||||
const app = new Koa();
|
||||
|
||||
app.use(session({
|
||||
store: redisStore({
|
||||
url: 'redis://url:123',
|
||||
host: 'redisHost',
|
||||
port: 123,
|
||||
path: 'redis/path',
|
||||
db: '2',
|
||||
duplicate: false,
|
||||
client: {}
|
||||
})
|
||||
}));
|
||||
|
||||
app.listen(80);
|
||||
22
types/koa-redis/tsconfig.json
Normal file
22
types/koa-redis/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"koa-redis-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/koa-redis/tslint.json
Normal file
1
types/koa-redis/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user