Merge pull request #31691 from BendingBender/list-git-remotes

[list-git-remotes] Add types
This commit is contained in:
Wesley Wigham
2018-12-25 22:38:39 -08:00
committed by GitHub
4 changed files with 65 additions and 0 deletions
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for list-git-remotes 1.0
// Project: https://github.com/jonschlinkert/list-git-remotes
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { ExecException, ExecSyncOptions } from 'child_process';
export = listGitRemotes;
declare function listGitRemotes(callback: listGitRemotes.Callback): void;
declare function listGitRemotes(cwd: string, callback: listGitRemotes.Callback): void;
declare namespace listGitRemotes {
function sync(cwd?: string, options?: ExecSyncOptions): Remotes;
function sync(options: ExecSyncOptions): Remotes;
type Callback = (err: ExecException | null, remotes: Remotes, stderr?: string) => void;
interface Remotes {
[key: string]: string;
}
}
@@ -0,0 +1,17 @@
import remotes = require('list-git-remotes');
remotes((err, res, stderr) => {
err; // $ExpectType ExecException | null
res; // $ExpectType Remotes
stderr; // $ExpectType string | undefined
});
remotes('some/project', (err, res, stderr) => {
err; // $ExpectType ExecException | null
res; // $ExpectType Remotes
stderr; // $ExpectType string | undefined
});
remotes.sync(); // $ExpectType Remotes
remotes.sync('some/project'); // $ExpectType Remotes
remotes.sync('some/project', { shell: 'foo' }); // $ExpectType Remotes
remotes.sync({ cwd: 'some/project', shell: 'foo' }); // $ExpectType Remotes
+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",
"list-git-remotes-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }