Merge pull request #31244 from BendingBender/move-file

Add types for move-file
This commit is contained in:
Nathan Shively-Sanders
2018-12-17 15:10:50 -08:00
committed by GitHub
4 changed files with 54 additions and 0 deletions
+20
View File
@@ -0,0 +1,20 @@
// Type definitions for move-file 1.0
// Project: https://github.com/sindresorhus/move-file#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = moveFile;
declare function moveFile(
source: string,
destination: string,
options?: moveFile.Options
): Promise<void>;
declare namespace moveFile {
function sync(source: string, destination: string, options?: Options): void;
interface Options {
overwrite?: boolean;
}
}
+10
View File
@@ -0,0 +1,10 @@
import moveFile = require('move-file');
// $ExpectType Promise<void>
moveFile('source/unicorn.png', 'destination/unicorn.png');
// $ExpectType Promise<void>
moveFile('source/unicorn.png', 'destination/unicorn.png', { overwrite: false });
// $ExpectType void
moveFile.sync('source/unicorn.png', 'destination/unicorn.png');
// $ExpectType void
moveFile.sync('source/unicorn.png', 'destination/unicorn.png', { overwrite: false });
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"move-file-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }