From c4a72bc3ffe73e483de6cee21455eb4c23315610 Mon Sep 17 00:00:00 2001 From: Ryan Clark Date: Tue, 5 Jun 2018 15:08:03 +0200 Subject: [PATCH] Add typings for git-branch --- types/git-branch/git-branch-tests.ts | 14 ++++++++++++++ types/git-branch/index.d.ts | 15 +++++++++++++++ types/git-branch/tsconfig.json | 23 +++++++++++++++++++++++ types/git-branch/tslint.json | 1 + 4 files changed, 53 insertions(+) create mode 100644 types/git-branch/git-branch-tests.ts create mode 100644 types/git-branch/index.d.ts create mode 100644 types/git-branch/tsconfig.json create mode 100644 types/git-branch/tslint.json diff --git a/types/git-branch/git-branch-tests.ts b/types/git-branch/git-branch-tests.ts new file mode 100644 index 0000000000..4b02cb5da3 --- /dev/null +++ b/types/git-branch/git-branch-tests.ts @@ -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) => {}); diff --git a/types/git-branch/index.d.ts b/types/git-branch/index.d.ts new file mode 100644 index 0000000000..a1cecc9691 --- /dev/null +++ b/types/git-branch/index.d.ts @@ -0,0 +1,15 @@ +// Type definitions for git-branch 2.0 +// Project: https://github.com/jonschlinkert/git-branch +// Definitions by: Ryan Clark +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped +// TypeScript Version: 2.3 + +export = GitBranch; + +declare function GitBranch(cwd?: string): Promise; +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; +} diff --git a/types/git-branch/tsconfig.json b/types/git-branch/tsconfig.json new file mode 100644 index 0000000000..0ed27223a0 --- /dev/null +++ b/types/git-branch/tsconfig.json @@ -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" + ] +} diff --git a/types/git-branch/tslint.json b/types/git-branch/tslint.json new file mode 100644 index 0000000000..3db14f85ea --- /dev/null +++ b/types/git-branch/tslint.json @@ -0,0 +1 @@ +{ "extends": "dtslint/dt.json" }