Skip to content

Commit

Permalink
Fixed typings
Browse files Browse the repository at this point in the history
  • Loading branch information
ktaeyln committed Mar 21, 2018
1 parent 9477550 commit f9a1aeb
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 40 deletions.
55 changes: 17 additions & 38 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,38 +1,17 @@
declare const _default: {
new <V extends object>(options?: {
timeout?: number;
capacity?: number;
retimeOnAccess?: boolean;
}): {
accesses: {
[index: string]: number;
};
timeouts: {
[index: string]: number;
};
destructors: {
[index: string]: Function;
};
generateQueue: {
[index: string]: ((err: Error, value?: V) => void)[];
};
retimeOnAccess: boolean;
capacity: number;
timeout: number;
clear(): void;
delete(key: string): boolean;
makeDestruct(key: string): () => void;
set(key: string, value: V): any;
get(key: string): V;
forEach(callbackfn: (value: V, key: string, map: Map<string, V>) => void, thisArg?: any): void;
generate(key: string, generator: (key: string, callback: (err: Error, value?: V) => void) => void, callback: (err: Error, value?: V) => void): void;
entries(): IterableIterator<[string, V]>;
values(): IterableIterator<V>;
has(key: string): boolean;
readonly size: number;
[Symbol.iterator](): IterableIterator<[string, V]>;
keys(): IterableIterator<string>;
readonly [Symbol.toStringTag]: "Map";
};
};
export = _default;
/// <reference types="node" />

module lru_weak_cache {
declare interface LRUWeakCacheGenerator {
(key: string, callback: (err: Error, value?: V) => void): void;
}
declare interface LRUWeakCache<V extends object> extends Map<string, V> {
generate(key: string, generator: LRUWeakCacheGenerator, callback: (err: Error, value?: V) => void): void;
}
declare interface LRUWeakCacheConstructor {
new (options: {timeout?: number,capacity?: number,retimeOnAccess?:boolean}): LRUWeakCache;
}
declare var LRUWeakCache: LRUWeakCacheConstructor;
}
module "lru-weak-cache" {
export = lru_weak_cache.LRUWeakCacheConstructor;
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "lru-weak-cache",
"version": "0.1.1",
"version": "0.1.2",
"description": "A caching Map<string, ?> that deletes the least-recently-accessed items with weak references.",
"main": "index.js",
"scripts": {
Expand All @@ -12,6 +12,7 @@
"contributors": [
"Katelyn Slater <kate@nexustools.com>"
],
"typings": "./index.d.ts",
"license": "Apache-2.0",
"devDependencies": {
"@types/weak": "^1.0.0",
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
"compileOnSave": true,
"compilerOptions": {
"target": "ES6",
"declaration": true,
"module": "commonjs",
"removeComments": true,
"preserveConstEnums": true,
Expand All @@ -12,6 +11,7 @@
},
"files": [
"index.ts",
"index.d.ts",
"test/tests.ts"
],
"exclude": [
Expand Down

0 comments on commit f9a1aeb

Please sign in to comment.