Add types for move-file

This commit is contained in:
Dimitri Benin
2018-12-10 21:14:21 +01:00
parent 0d4d1453b2
commit c724e7a2d8
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" }