Skip to content

Commit

Permalink
Merge pull request #19 from dlee-nvisia/master
Browse files Browse the repository at this point in the history
Add typescript definitions
  • Loading branch information
benjamingr authored Jun 1, 2018
2 parents 0be2c61 + e9bc168 commit ab1883a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
21 changes: 21 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -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<FileResult>;
export function withFile<T>(fn: (result: FileResult) => Promise<T>): Promise<T>;

export function dir(options?: Options): Promise<DirectoryResult>;
export function withDir<T>(fn: (results: DirectoryResult) => Promise<T>): Promise<T>;

export function tmpName(options?: SimpleOptions): Promise<string>;

export { fileSync, dirSync, tmpNameSync, setGracefulCleanup }
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand All @@ -24,6 +25,7 @@
"tmp": "0.0.33"
},
"devDependencies": {
"@types/tmp": "0.0.33",
"mocha": "^3.1.2"
}
}

0 comments on commit ab1883a

Please sign in to comment.