Add typings for git-branch

This commit is contained in:
Ryan Clark
2018-06-05 15:08:03 +02:00
parent b21fbc2d15
commit c4a72bc3ff
4 changed files with 53 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import gitBranch = require('git-branch');
gitBranch()
.then((name) => {});
gitBranch('cwd')
.then((name) => {});
gitBranch.sync();
gitBranch.sync('cwd');
gitBranch((err, name) => {});
gitBranch('cwd', (err, name) => {});

15
types/git-branch/index.d.ts vendored Normal file
View File

@@ -0,0 +1,15 @@
// Type definitions for git-branch 2.0
// Project: https://github.com/jonschlinkert/git-branch
// Definitions by: Ryan Clark <https://github.com/rynclark>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
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 namespace GitBranch {
function sync(cwd?: string): string;
}

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",
"git-branch-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }