diff --git a/index.d.ts b/index.d.ts new file mode 100644 index 0000000..78cb8b0 --- /dev/null +++ b/index.d.ts @@ -0,0 +1,21 @@ +import { fileSync, dirSync, tmpNameSync, setGracefulCleanup } from 'tmp'; +import { Options, SimpleOptions } from 'tmp'; + +export interface DirectoryResult { + path: string; + cleanup(): void; +} + +export interface FileResult extends DirectoryResult { + fd: number; +} + +export function file(options?: Options): Promise; +export function withFile(fn: (result: FileResult) => Promise): Promise; + +export function dir(options?: Options): Promise; +export function withDir(fn: (results: DirectoryResult) => Promise): Promise; + +export function tmpName(options?: SimpleOptions): Promise; + +export { fileSync, dirSync, tmpNameSync, setGracefulCleanup } \ No newline at end of file diff --git a/package.json b/package.json index cecec51..521f0eb 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,7 @@ "version": "1.0.4", "description": "The tmp package with promises support and disposers.", "main": "index.js", + "types": "index.d.ts", "scripts": { "test": "mocha" }, @@ -24,6 +25,7 @@ "tmp": "0.0.33" }, "devDependencies": { + "@types/tmp": "0.0.33", "mocha": "^3.1.2" } }