diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..d6b8746 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,30 @@ +namespace Receptacle { + export interface Options { + id?: string; + max?: number; + items?: any[]; + } + + export interface SetOptions { + ttl?: number; + refresh?: boolean; + meta?: X; + } +} + +class Receptacle { + constructor(options?: Receptacle.Options); + public id: string; + public max: number; + public items: T[]; + public size: number; + public has(key: string): boolean; + public get(key: string): T; + public meta(key: string): X; + public set(key: string, value: T, options?: Receptacle.SetOptions): void; + public delete(key: string): void; + public expire(key: string, ms: number = 0): void; + public clear(): void; +} + +export = Receptacle; diff --git a/package.json b/package.json index ee60eed..67f7d20 100644 --- a/package.json +++ b/package.json @@ -44,6 +44,7 @@ "test": "npm run lint && make test", "test-ci": "npm run lint && make test-ci" }, + "typings": "./index.d.ts", "standard": { "globals": [ "GIT_COMMIT",