diff --git a/types/tempy/index.d.ts b/types/tempy/index.d.ts index ec210e0829..15c1664409 100644 --- a/types/tempy/index.d.ts +++ b/types/tempy/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for tempy 0.1 +// Type definitions for tempy 0.2 // Project: https://github.com/sindresorhus/tempy#readme -// Definitions by: Douglas Duteil +// Definitions by: Douglas Duteil , Gustav Bylund // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped -export function directoryAsync(): Promise; export function directory(): string; -export function file(options?: {extension: string}): string; +export function file( + options?: { extension: string } | { name: string } +): string; export const root: string; diff --git a/types/tempy/tempy-tests.ts b/types/tempy/tempy-tests.ts index 56ec437e55..0af9467bb2 100644 --- a/types/tempy/tempy-tests.ts +++ b/types/tempy/tempy-tests.ts @@ -1,12 +1,12 @@ -import { directoryAsync, directory, file, root } from 'tempy'; +import { directory, file, root } from "tempy"; // -directoryAsync().then((tempDir1: string) => tempDir1 === '/tmp/123456789'); - const tempDir2: string = directory(); const tempFile: string = file(); -const pngFile: string = file({extension: 'png'}); +const pngFile: string = file({ extension: "png" }); + +const fileWithName: string = file({ name: "afile.txt" }); const tmpRoot: string = root;