diff --git a/index.d.ts b/index.d.ts index 84650b6..fa4b910 100644 --- a/index.d.ts +++ b/index.d.ts @@ -1,19 +1,22 @@ declare const unusedFilename: { /** - * Get an unused filename by appending a number if it exists: `file.txt` → `file (1).txt`. - * - * @param filePath - The path to check for filename collision. - * @returns Either the original `filename` or the `filename` appended with a number. - */ + Get an unused filename by appending a number if it exists: `file.txt` → `file (1).txt`. + + @param filePath - The path to check for filename collision. + @returns Either the original `filename` or the `filename` appended with a number. + */ (filePath: string): Promise; /** - * Synchronously get an unused filename by appending a number if it exists: `file.txt` → `file (1).txt`. - * - * @param filePath - The path to check for filename collision. - * @returns Either the original `filename` or the `filename` appended with a number. - */ + Synchronously get an unused filename by appending a number if it exists: `file.txt` → `file (1).txt`. + + @param filePath - The path to check for filename collision. + @returns Either the original `filename` or the `filename` appended with a number. + */ sync(filePath: string): string; -} -export default unusedFilename; + // TODO: Remove this for the next major release + default: typeof unusedFilename; +}; + +export = unusedFilename; diff --git a/index.js b/index.js index e26dc09..f8f8c10 100644 --- a/index.js +++ b/index.js @@ -14,6 +14,7 @@ const unusedFilename = filePath => { }; module.exports = unusedFilename; +// TODO: Remove this for the next major release module.exports.default = unusedFilename; module.exports.sync = filePath => { diff --git a/index.test-d.ts b/index.test-d.ts index 164b5f4..f87a178 100644 --- a/index.test-d.ts +++ b/index.test-d.ts @@ -1,5 +1,5 @@ -import {expectType} from 'tsd-check'; -import unusedFilename from '.'; +import {expectType} from 'tsd'; +import unusedFilename = require('.'); expectType>(unusedFilename('rainbow.txt')); expectType(unusedFilename.sync('rainbow.txt')); diff --git a/package.json b/package.json index a1bf7cd..06d87cf 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "node": ">=8" }, "scripts": { - "test": "xo && ava && tsd-check" + "test": "xo && ava && tsd" }, "files": [ "index.js", @@ -36,11 +36,11 @@ ], "dependencies": { "modify-filename": "^1.1.0", - "path-exists": "^3.0.0" + "path-exists": "^4.0.0" }, "devDependencies": { - "ava": "^1.3.1", - "tsd-check": "^0.3.0", + "ava": "^1.4.1", + "tsd": "^0.7.2", "xo": "^0.24.0" } }