// Type definitions for jfs 0.2 // Project: http://github.com/flosse/json-file-store // Definitions by: Tomasz Łaziuk // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // TypeScript Version: 2.1 declare const JsonFileStore: JsonFileStore.JsonFileStore; declare namespace JsonFileStore { interface Storable { [key: string]: any; } interface Options { type?: 'single' | 'memory' | undefined; pretty?: boolean | undefined; saveId?: boolean | string | undefined; } interface JsonFileStore { new (name?: string, opts?: Options): Instance; } interface Instance { save(id: K, o: V, cb?: (err?: Error, id?: K) => void): void; save(o: V, cb?: (err?: Error, id?: string) => void): void; saveSync(id: K, o: V): void; saveSync(o: V): void; get(id: K, cb?: (err?: Error, o?: V) => void): void; getSync(id: K): V | Error; delete(id: K, cb?: (err?: Error) => void): void; deleteSync(id: K): Error | void; all(cb: (err?: Error, all?: T) => void): void; allSync(): T; } } export = JsonFileStore;