Merge pull request #31807 from BendingBender/keyv__mysql

[@keyv/mysql] Add types
This commit is contained in:
Sheetal Nandi
2019-01-03 10:48:04 -08:00
committed by GitHub
4 changed files with 74 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
// Type definitions for @keyv/mysql 1.1
// Project: https://github.com/lukechilds/keyv-mysql
// 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 = KeyvMysql;
declare class KeyvMysql extends EventEmitter implements Store<string | undefined> {
readonly ttlSupport: false;
namespace?: string;
constructor(uri?: string);
constructor(options?: KeyvMysql.Options); // tslint:disable-line:unified-signatures
get(key: string): Promise<string | undefined>;
set(key: string, value: string | undefined): Promise<any>;
delete(key: string): Promise<boolean>;
clear(): Promise<void>;
}
declare namespace KeyvMysql {
interface Options {
uri?: string;
table?: string;
keySize?: number;
}
}
+12
View File
@@ -0,0 +1,12 @@
import Keyv = require('keyv');
import KeyvMysql = require('@keyv/mysql');
new Keyv('mysql://user:pass@localhost:3306/dbname', { table: 'cache' });
new KeyvMysql('mysql://user:pass@localhost:3306/dbname');
new KeyvMysql({ uri: 'mysql://user:pass@localhost:3306/dbname' });
new KeyvMysql({ table: 'cache' });
new KeyvMysql({ keySize: 100 });
const mysql = new KeyvMysql({ uri: 'mysql://user:pass@localhost:3306/dbname' });
new Keyv({ store: mysql });
+28
View File
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"paths": {
"@keyv/mysql": [
"keyv__mysql"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"keyv__mysql-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }