[git-branch] Improve types (#31676)

This commit is contained in:
Dimitri Benin
2018-12-31 08:04:17 -08:00
committed by Wesley Wigham
parent 44b33a09c5
commit a3b7804c74
2 changed files with 11 additions and 7 deletions
+10 -6
View File
@@ -1,14 +1,18 @@
import gitBranch = require('git-branch');
gitBranch()
.then((name) => {});
.then((name) => {
name; // $ExpectType string
});
gitBranch('cwd')
.then((name) => {});
.then((name) => {
name; // $ExpectType string
});
gitBranch.sync();
gitBranch.sync('cwd');
gitBranch.sync(); // $ExpectType string
gitBranch.sync('cwd'); // $ExpectType string
gitBranch((err, name) => {});
gitBranch((err, name) => {}); // $ExpectType void
gitBranch('cwd', (err, name) => {});
gitBranch('cwd', (err, name) => {}); // $ExpectType void
+1 -1
View File
@@ -8,7 +8,7 @@ export = GitBranch;
declare function GitBranch(cwd?: string): Promise<string>;
declare function GitBranch(cwd?: string, callback?: (err: null | string, name: string) => void): void;
declare function GitBranch(callback?: (err: null | string, name: string) => void): void;
declare function GitBranch(callback: (err: null | string, name: string) => void): void;
declare namespace GitBranch {
function sync(cwd?: string): string;