diff --git a/types/temp/index.d.ts b/types/temp/index.d.ts index a6b6f42ace..0a452a221b 100644 --- a/types/temp/index.d.ts +++ b/types/temp/index.d.ts @@ -1,11 +1,11 @@ -// Type definitions for temp 0.8.3 +// Type definitions for temp 0.8 // Project: https://www.npmjs.com/package/temp, https://github.com/bruce/node-temp // Definitions by: Daniel Rosenwasser // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped /// -import * as temp from "temp"; +import * as temp from "."; import * as fs from "fs"; export interface OpenFile { @@ -24,29 +24,22 @@ export interface AffixOptions { dir?: string; } -export declare var dir: string; +export let dir: string; -export declare function track(value?: boolean): typeof temp; +export function track(value?: boolean): typeof temp; -export declare function mkdir(affixes?: string, callback?: (err: any, dirPath: string) => void): void; -export declare function mkdir(affixes?: AffixOptions, callback?: (err: any, dirPath: string) => void): void; +export function mkdir(affixes?: string | AffixOptions, callback?: (err: any, dirPath: string) => void): void; -export declare function mkdirSync(affixes?: string): string; -export declare function mkdirSync(affixes?: AffixOptions): string; +export function mkdirSync(affixes?: string | AffixOptions): string; -export declare function open(affixes?: string, callback?: (err: any, result: OpenFile) => void): void; -export declare function open(affixes?: AffixOptions, callback?: (err: any, result: OpenFile) => void): void; +export function open(affixes?: string | AffixOptions, callback?: (err: any, result: OpenFile) => void): void; -export declare function openSync(affixes?: string): OpenFile; -export declare function openSync(affixes?: AffixOptions): OpenFile; +export function openSync(affixes?: string | AffixOptions): OpenFile; -export declare function path(affixes?: string, defaultPrefix?: string): string; -export declare function path(affixes?: AffixOptions, defaultPrefix?: string): string; +export function path(affixes?: string | AffixOptions, defaultPrefix?: string): string; -export declare function cleanup(callback?: (result: boolean | Stats) => void): void; +export function cleanup(callback?: (result: boolean | Stats) => void): void; -export declare function cleanupSync(): boolean | Stats; - -export declare function createWriteStream(affixes?: string): fs.WriteStream; -export declare function createWriteStream(affixes?: AffixOptions): fs.WriteStream; +export function cleanupSync(): boolean | Stats; +export function createWriteStream(affixes?: string | AffixOptions): fs.WriteStream; diff --git a/types/temp/temp-tests.ts b/types/temp/temp-tests.ts index 78eff82298..2f87334249 100644 --- a/types/temp/temp-tests.ts +++ b/types/temp/temp-tests.ts @@ -5,9 +5,8 @@ import * as temp from "temp"; function testCleanup() { temp.cleanup(result => { if (typeof result === "boolean") { - const x = result === true; - } - else { + const x = result; + } else { const { files, dirs } = result; files.toPrecision(4); files.toPrecision(4); @@ -16,12 +15,11 @@ function testCleanup() { } function testCleanupSync() { - const cleanupResult: boolean | temp.Stats = temp.cleanupSync() + const cleanupResult: boolean | temp.Stats = temp.cleanupSync(); if (typeof cleanupResult === "boolean") { - const x = cleanupResult === true; - } - else { - const { dirs, files } = cleanupResult + const x = cleanupResult; + } else { + const { dirs, files } = cleanupResult; dirs.toPrecision(4); files.toPrecision(4); } diff --git a/types/temp/tslint.json b/types/temp/tslint.json new file mode 100644 index 0000000000..495d29983d --- /dev/null +++ b/types/temp/tslint.json @@ -0,0 +1,5 @@ +{ + "extends": "dtslint/dt.json", + "rules": { + } +}