[@keyv/sqlite] Add types

This commit is contained in:
Dimitri Benin
2018-12-31 19:18:20 +01:00
parent 9272fc1637
commit deb6f8ae48
4 changed files with 74 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
// Type definitions for @keyv/sqlite 2.0
// Project: https://github.com/lukechilds/keyv-sqlite
// 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 = KeyvSqlite;
declare class KeyvSqlite extends EventEmitter implements Store<string | undefined> {
readonly ttlSupport: false;
namespace?: string;
constructor(options?: KeyvSqlite.Options);
get(key: string): Promise<string | undefined>;
set(key: string, value: string | undefined): Promise<any>;
delete(key: string): Promise<boolean>;
clear(): Promise<void>;
}
declare namespace KeyvSqlite {
interface Options {
uri?: string;
busyTimeout?: number;
table?: string;
keySize?: number;
}
}
+12
View File
@@ -0,0 +1,12 @@
import Keyv = require('keyv');
import KeyvSqlite = require('@keyv/sqlite');
new Keyv('sqlite://path/to/database.sqlite', { table: 'cache' });
new KeyvSqlite({ uri: 'sqlite://path/to/database.sqlite' });
new KeyvSqlite({ busyTimeout: 10000 });
new KeyvSqlite({ table: 'cache' });
new KeyvSqlite({ keySize: 100 });
const sqlite = new KeyvSqlite({ uri: 'sqlite://path/to/database.sqlite' });
new Keyv({ store: sqlite });
+28
View File
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"paths": {
"@keyv/sqlite": [
"keyv__sqlite"
]
},
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"keyv__sqlite-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }