mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Return type on ignore function was missing and Promise return type was missing from overloads that didn't take a callback. Also extracts out a helper type definitions and provides slightly better variable naming for the transient `recursiveReadDir`.
22 lines
859 B
TypeScript
22 lines
859 B
TypeScript
// Type definitions for recursive-readdir 2.2
|
|
// Project: https://github.com/jergason/recursive-readdir/
|
|
// Definitions by: Elisée Maurer <https://github.com/elisee>, Micah Zoltu <https://github.com/MicahZoltu>
|
|
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
|
|
|
/// <reference types="node" />
|
|
|
|
import * as fs from "fs";
|
|
declare namespace RecursiveReaddir {
|
|
type IgnoreFunction = (file: string, stats: fs.Stats) => boolean;
|
|
type Ignores = ReadonlyArray<string|IgnoreFunction>;
|
|
type Callback = (error: Error, files: string[]) => void;
|
|
interface readDir {
|
|
(path: string, ignores?: Ignores): Promise<string[]>;
|
|
(path: string, callback: Callback): void;
|
|
(path: string, ignores: Ignores, callback: Callback): void;
|
|
}
|
|
}
|
|
|
|
declare var recursiveReadDir: RecursiveReaddir.readDir;
|
|
export = recursiveReadDir;
|