Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript-file #8

Open
Muhaah opened this issue Jun 3, 2017 · 0 comments
Open

Typescript-file #8

Muhaah opened this issue Jun 3, 2017 · 0 comments

Comments

@Muhaah
Copy link

Muhaah commented Jun 3, 2017

I created a Typescript-Definition file .. so maybe you can add it in your lib (https://stackoverflow.com/questions/37210059/how-to-add-a-typescript-definition-file-to-a-npm-package).

declare module "memored" {

    // https://github.com/PaquitoSoft/memored#setupoptions
    export interface IMemoredLogger {
        log: (message: string) => any
        warn: (message: string) => any
    }
    function setup<T extends IMemoredLogger>(options?: { purgeInterval?: number, logger?: T }): void

    // https://github.com/PaquitoSoft/memored#storekey-value-ttl-callback
    function store(key: string, value: any, ttl: number, cb?: (err: Error, expirationTime: number) => any): void
    function store(key: string, value: any, cb?: (err: Error | null, expirationTime: number) => any): void

    // https://github.com/PaquitoSoft/memored#multistoremap-ttl-callback
    interface IMultiKeyValue {
        [index: string]: any
    }
    function multiStore(IMultiKeyValue: IMultiKeyValue, ttl: number, cb?: (err: Error
                                                                               | null, expirationTime: number) => any): void
    function multiStore(IMultiKeyValue: IMultiKeyValue, cb?: (err: Error | null, expirationTime: number) => any): void

    // https://github.com/PaquitoSoft/memored#readkey-callback
    function read(key: string, cb: (err: Error | null, value: any) => any): void

    // https://github.com/PaquitoSoft/memored#multireadkeys-callback
    function multiRead(keys: Array<string>, cb: (err: Error | null, values: IMultiKeyValue) => any): void

    // https://github.com/PaquitoSoft/memored#removekey-callback
    function remove(key: string, cb?: () => any): void

    // https://github.com/PaquitoSoft/memored#multiremovekeys-callback
    function multiRemove(keys: Array<string>, cb?: () => any): void

    // https://github.com/PaquitoSoft/memored#cleancallback
    function clean(cb?: () => any): void

    // https://github.com/PaquitoSoft/memored#sizecallback
    function size(cb: (err: Error | null, size: number) => any): void

    // https://github.com/PaquitoSoft/memored#keyscallback
    function keys(cb: (err: Error | null, keys: Array<string>) => any): void
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant