Skip to content

Commit

Permalink
Add definition for tempy (flow-typed#1495)
Browse files Browse the repository at this point in the history
* Add definition for tempy

* trigger rebuild
  • Loading branch information
callumlocke authored and gantoine committed Nov 8, 2017
1 parent d7ad169 commit 56b4548
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
12 changes: 12 additions & 0 deletions definitions/npm/tempy_v0.x.x/flow_v0.47.x-/tempy_v0.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
type $npm$tempy$Options = {
extension?: string,
name?: string
};

declare module "tempy" {
declare module.exports: {
directory: () => string,
file: (options?: $npm$tempy$Options) => string,
root: string
};
}
17 changes: 17 additions & 0 deletions definitions/npm/tempy_v0.x.x/test_tempy_v0.x.x.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const tempy = require("tempy");

(tempy.file(): string);

(tempy.file({ extension: ".txt" }): string);

(tempy.file({ name: "foo.txt" }): string);

// $ExpectError
tempy.file(123);

(tempy.directory(): string);

// $ExpectError
tempy.directory({});

(tempy.root: string);

0 comments on commit 56b4548

Please sign in to comment.