Skip to content

Commit 40c6085

Browse files
committed
Merge pull request DefinitelyTyped#7247 from DanielRosenwasser/tempMkdir
Fixes in 'temp' definitions
2 parents 78ba6e4 + f83d1a7 commit 40c6085

File tree

2 files changed

+22
-13
lines changed

2 files changed

+22
-13
lines changed

temp/temp-tests.ts

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ function testCleanup() {
1111
}
1212
else {
1313
const { files, dirs } = result;
14+
files.toPrecision(4);
15+
files.toPrecision(4);
1416
}
1517
});
1618
}
@@ -22,16 +24,22 @@ function testCleanupSync() {
2224
}
2325
else {
2426
const { dirs, files } = cleanupResult
27+
dirs.toPrecision(4);
28+
files.toPrecision(4);
2529
}
2630
}
2731

2832
function testOpen() {
2933
temp.open({ dir: "tempDir", prefix: "pref", suffix: "suff" }, (err, result) => {
3034
const { path, fd } = result;
35+
path.length;
36+
fd.toPrecision(5);
3137
});
3238

3339
temp.open("strPrefix", (err, result) => {
3440
const { path, fd } = result;
41+
path.length;
42+
fd.toPrecision(5);
3543
});
3644
}
3745

@@ -45,23 +53,24 @@ function testCreateWriteStream() {
4553
stream.write("data");
4654
}
4755

48-
function testMkDir() {
49-
temp.mkDir("prefix", (err, dirPath) => {
56+
function testMkdir() {
57+
temp.mkdir("prefix", (err, dirPath) => {
5058
dirPath.length;
5159
});
5260
}
5361

54-
function testMkDirSync() {
55-
const result = temp.mkDirSync("prefix");
62+
function testMkdirSync() {
63+
const result = temp.mkdirSync("prefix");
5664
result.length;
5765
}
5866

5967
function testPath() {
60-
temp.path({ suffix: "justSuffix" }, "defaultPrefix");
68+
const p = temp.path({ suffix: "justSuffix" }, "defaultPrefix");
69+
p.length;
6170
}
6271

6372
function testTrack() {
64-
const tempChained = temp.track(true).track(false);
73+
const tempChained = temp.track().track(true).track(false);
6574
tempChained.dir;
6675
tempChained.cleanupSync();
6776
}

temp/temp.d.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,22 +17,22 @@ declare module "temp" {
1717

1818
export var dir: string;
1919

20-
export function track(value: boolean): typeof temp;
20+
export function track(value?: boolean): typeof temp;
2121

22-
export function mkDir(affixes: string, callback?: (err: any, dirPath: string) => void): void;
23-
export function mkDir(affixes: AffixOptions, callback?: (err: any, dirPath: string) => void): void;
22+
export function mkdir(affixes: string, callback?: (err: any, dirPath: string) => void): void;
23+
export function mkdir(affixes: AffixOptions, callback?: (err: any, dirPath: string) => void): void;
2424

25-
export function mkDirSync(affixes: string): string;
26-
export function mkDirSync(affixes: AffixOptions): string;
25+
export function mkdirSync(affixes: string): string;
26+
export function mkdirSync(affixes: AffixOptions): string;
2727

2828
export function open(affixes: string, callback?: (err: any, result: {path: string, fd: number}) => void): void;
2929
export function open(affixes: AffixOptions, callback?: (err: any, result: {path: string, fd: number}) => void): void;
3030

3131
export function openSync(affixes: string): { path: string, fd: number };
3232
export function openSync(affixes: AffixOptions): { path: string, fd: number };
3333

34-
export function path(affixes: string, defaultPrefix: string): void;
35-
export function path(affixes: AffixOptions, defaultPrefix: string): void;
34+
export function path(affixes: string, defaultPrefix: string): string;
35+
export function path(affixes: AffixOptions, defaultPrefix: string): string;
3636

3737
export function cleanup(callback?: (result: boolean | {files: number, dirs?: number}) => void): void;
3838

0 commit comments

Comments
 (0)