0.2.9 • Published 6 months ago

@types/jfs v0.2.9

Weekly downloads
490
License
MIT
Repository
github
Last release
6 months ago

Installation

npm install --save @types/jfs

Summary

This package contains type definitions for jfs (https://github.com/flosse/json-file-store).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/jfs.

index.d.ts

// Type definitions for jfs 0.2
// Project: https://github.com/flosse/json-file-store
// Definitions by: Tomasz Łaziuk <https://github.com/tlaziuk>
// 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 <T extends Storable>(name?: string, opts?: Options): Instance<T>;
    }

    interface Instance<T> {
        save<K extends keyof T, V extends T[K]>(id: K, o: V, cb?: (err?: Error, id?: K) => void): void;
        save<V extends T[keyof T]>(o: V, cb?: (err?: Error, id?: string) => void): void;

        saveSync<K extends keyof T, V extends T[K]>(id: K, o: V): void;
        saveSync<V extends T[keyof T]>(o: V): void;

        get<K extends keyof T, V extends T[K]>(id: K, cb?: (err?: Error, o?: V) => void): void;

        getSync<K extends keyof T, V extends T[K]>(id: K): V | Error;

        delete<K extends keyof T>(id: K, cb?: (err?: Error) => void): void;

        deleteSync<K extends keyof T>(id: K): Error | void;

        all(cb: (err?: Error, all?: T) => void): void;

        allSync(): T;
    }
}

export = JsonFileStore;

Additional Details

  • Last updated: Thu, 16 Dec 2021 22:31:59 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by Tomasz Łaziuk.

0.2.7

7 months ago

0.2.6

8 months ago

0.2.9

6 months ago

0.2.8

6 months ago

0.2.5

2 years ago

0.2.4

3 years ago

0.2.3

5 years ago

0.2.2

7 years ago

0.2.1

7 years ago

0.2.0

7 years ago