anzip icon indicating copy to clipboard operation
anzip copied to clipboard

feat : add support for Typescript

Open mikbry opened this issue 5 years ago • 1 comments

Description

It will be cool to use this library using Typescript

mikbry avatar Jan 29 '20 17:01 mikbry

I hand-rolled a type declaration file for this library to help TS with static typing. It might be helpful to you

declare module "anzip" {
    interface Options {
        pattern?: RegExp,
        disableSave?: boolean,
        outputContent?: boolean,
        entryHandler?: Promise<boolean>,
        outputPath?: string,
        flattenPath?: boolean,
        disableOutput?: boolean,
        rules?: Options[]
    }

    interface File {
        name: string,
        directory: string,
        saved: boolean,
        content: Buffer,
        error: Error
    }

    interface Result {
        duration: number,
        files: File[],
    }

    function anzip(
        filename: string,
        opts?: Options
    ): Promise<Result>;

    export = anzip;
}

pavi2410 avatar Jan 22 '22 11:01 pavi2410