Merge pull request #31682 from BendingBender/git-repo-name

[git-repo-name] Add types
This commit is contained in:
Wesley Wigham
2018-12-25 13:03:37 -08:00
committed by GitHub
4 changed files with 73 additions and 0 deletions
@@ -0,0 +1,26 @@
import repoName = require('git-repo-name');
repoName('foo'); // $ExpectType Promise<string>
repoName({ cwd: 'foo' }); // $ExpectType Promise<string>
repoName({ path: 'foo' }); // $ExpectType Promise<string>
// $ExpectType void
repoName((err, repoName) => {
err; // $ExpectType Error | null
repoName; // $ExpectType string
});
// $ExpectType void
repoName('foo', (err, repoName) => {
err; // $ExpectType Error | null
repoName; // $ExpectType string
});
// $ExpectType void
repoName({ cwd: 'foo' }, (err, repoName) => {
err; // $ExpectType Error | null
repoName; // $ExpectType string
});
repoName.promise('foo'); // $ExpectType Promise<string>
repoName.promise({ cwd: 'foo' }); // $ExpectType Promise<string>
repoName.sync('foo'); // $ExpectType string
repoName.sync({ cwd: 'foo' }); // $ExpectType string
+23
View File
@@ -0,0 +1,23 @@
// Type definitions for git-repo-name 1.0
// Project: https://github.com/jonschlinkert/git-repo-name
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = gitRepoName;
declare function gitRepoName(options?: string | gitRepoName.Options): Promise<string>;
declare function gitRepoName(callback: (err: Error | null, repoName: string) => void): void;
declare function gitRepoName(
options: string | gitRepoName.Options,
callback: (err: Error | null, repoName: string) => void
): void;
declare namespace gitRepoName {
function promise(options?: string | Options): Promise<string>;
function sync(options?: string | Options): string;
interface Options {
cwd?: string;
path?: string;
}
}
+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",
"git-repo-name-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }