mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
[@keyv/mongo] Add types (#31806)
This commit is contained in:
parent
ae36dd3474
commit
6fd150e951
33
types/keyv__mongo/index.d.ts
vendored
Normal file
33
types/keyv__mongo/index.d.ts
vendored
Normal file
@ -0,0 +1,33 @@
|
||||
// Type definitions for @keyv/mongo 1.0
|
||||
// Project: https://github.com/lukechilds/keyv-mongo
|
||||
// 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 { EventEmitter } from 'events';
|
||||
|
||||
export = KeyvMongo;
|
||||
|
||||
declare class KeyvMongo<TValue> extends EventEmitter implements Store<TValue> {
|
||||
readonly ttlSupport: false;
|
||||
namespace?: string;
|
||||
|
||||
constructor(uri?: string);
|
||||
constructor(options?: KeyvMongo.Options); // tslint:disable-line:unified-signatures
|
||||
|
||||
get(key: string): Promise<TValue | undefined>;
|
||||
set(key: string, value: TValue, ttl?: number): Promise<any>;
|
||||
delete(key: string): Promise<boolean>;
|
||||
clear(): Promise<void>;
|
||||
}
|
||||
|
||||
declare namespace KeyvMongo {
|
||||
interface Options {
|
||||
uri?: string;
|
||||
url?: string;
|
||||
collection?: string;
|
||||
}
|
||||
}
|
||||
12
types/keyv__mongo/keyv__mongo-tests.ts
Normal file
12
types/keyv__mongo/keyv__mongo-tests.ts
Normal file
@ -0,0 +1,12 @@
|
||||
import Keyv = require('keyv');
|
||||
import KeyvMongo = require('@keyv/mongo');
|
||||
|
||||
new Keyv('mongodb://user:pass@localhost:27017/dbname', { collection: 'cache' });
|
||||
|
||||
new KeyvMongo({ uri: 'mongodb://user:pass@localhost:27017/dbname' });
|
||||
new KeyvMongo({ url: 'mongodb://user:pass@localhost:27017/dbname' });
|
||||
new KeyvMongo({ collection: 'cache' });
|
||||
new KeyvMongo('mongodb://user:pass@localhost:27017/dbname');
|
||||
|
||||
const mongo = new KeyvMongo('mongodb://user:pass@localhost:27017/dbname');
|
||||
new Keyv({ store: mongo });
|
||||
28
types/keyv__mongo/tsconfig.json
Normal file
28
types/keyv__mongo/tsconfig.json
Normal file
@ -0,0 +1,28 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"@keyv/mongo": [
|
||||
"keyv__mongo"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"keyv__mongo-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/keyv__mongo/tslint.json
Normal file
1
types/keyv__mongo/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user