mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-05 23:37:04 +00:00
Merge pull request #32649 from MutterPedro/master
Added mem-cache module types definitions
This commit is contained in:
Vendored
+26
@@ -0,0 +1,26 @@
|
||||
// Type definitions for mem-cache 1.0
|
||||
// Project: https://github.com/silviom/node-mem-cache
|
||||
// Definitions by: Pedro Mutter <https://github.com/MutterPedro>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
interface CacheOptions {
|
||||
timeout?: number;
|
||||
doesNotRenewTimeout?: boolean;
|
||||
timeoutDisabled?: boolean;
|
||||
}
|
||||
|
||||
declare class Cache extends EventEmitter {
|
||||
keys: string[];
|
||||
length: number;
|
||||
|
||||
constructor(options?: number | CacheOptions);
|
||||
|
||||
set(key: string, value: any, timeout?: number): void;
|
||||
get(key: string): any;
|
||||
remove(key: string): void;
|
||||
clean(): void;
|
||||
}
|
||||
|
||||
export = Cache;
|
||||
@@ -0,0 +1,10 @@
|
||||
import Cache = require('mem-cache');
|
||||
|
||||
const cache = new Cache(); // $ExpectType Cache
|
||||
|
||||
cache.set('foo', 'bar'); // $ExpectType void
|
||||
cache.get('foo'); // $ExpectType any
|
||||
cache.remove('foo'); // $ExpectType void
|
||||
cache.clean(); // $ExpectType void
|
||||
cache.length; // $ExpectType number
|
||||
cache.keys; // $ExpectType string[]
|
||||
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"mem-cache-tests.ts"
|
||||
],
|
||||
"baseUrl": "types",
|
||||
"typeRoots": ["types"]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user