Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor TypeScript definition to CommonJS compatible export (#82)
- Loading branch information
1 parent
75c270b
commit bdfbd07
Showing
4 changed files
with
46 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,38 @@ | ||
export interface Options { | ||
/** | ||
* Enable globbing when matching file paths. | ||
* | ||
* @default true | ||
*/ | ||
readonly glob?: boolean; | ||
declare namespace trash { | ||
interface Options { | ||
/** | ||
Enable globbing when matching file paths. | ||
@default true | ||
*/ | ||
readonly glob?: boolean; | ||
} | ||
} | ||
|
||
/** | ||
* Move files and folders to the trash. | ||
* | ||
* @param input - Accepts paths and [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). | ||
*/ | ||
export default function trash( | ||
input: string | string[], | ||
options?: Options | ||
): Promise<void>; | ||
declare const trash: { | ||
/** | ||
Move files and folders to the trash. | ||
@param input - Accepts paths and [glob patterns](https://github.com/sindresorhus/globby#globbing-patterns). | ||
@example | ||
``` | ||
import trash = require('trash'); | ||
(async () => { | ||
await trash(['*.png', '!rainbow.png']); | ||
})(); | ||
``` | ||
*/ | ||
(input: string | string[], options?: trash.Options): Promise<void>; | ||
|
||
// TODO: Remove this for the next major release, refactor the whole definition to: | ||
// declare function trash( | ||
// input: string | string[], | ||
// options?: Options | ||
// ): Promise<void>; | ||
// export = trash; | ||
default: typeof trash; | ||
}; | ||
|
||
export = trash; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters