🤖 Merge PR #65496 Added definitions for "git-init" (supersedes #65055). by @santi100a

* initial commit for git-init

* modified

* addressed @jakebailey's code review
This commit is contained in:
Santi
2023-05-15 14:06:20 -05:00
committed by GitHub
parent 06c07f9cde
commit 5934d79207
4 changed files with 61 additions and 0 deletions

View File

@@ -0,0 +1,14 @@
import init = require('git-init');
// $ExpectType void
init((err: Error | null, stdout: any, stderr: any) => {
// something here
});
// $ExpectType void
init('./something/', (err: Error | null, stdout: any, stderr: any) => {
// something here
});
// @ts-expect-error
init(5);
// @ts-expect-error
init('./something', 5);

23
types/git-init/index.d.ts vendored Normal file
View File

@@ -0,0 +1,23 @@
// Type definitions for git-init 1.0
// Project: https://github.com/yoshuawuyts/git-init#readme
// Definitions by: Santi <https://github.com/santi100a>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import type { ExecException } from 'node:child_process';
type ExecCallback = (error: ExecException | null, stdout: string, stderr: string) => void;
/**
* Initializes a new Git repo in `path` asynchronously.
*
* @param path The path of the folder to be initialized as a Git repo.
* @param cb An `exec`-compatible callback defined in {@link ExecCallback}.
*/
declare function init(path: string, cb: ExecCallback): void;
/**
* Initializes a new Git repo in the current directory asynchronously.
*
* @param cb An `exec`-compatible callback defined in {@link ExecCallback}.
*/
declare function init(cb: ExecCallback): void;
export = init;

View File

@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictFunctionTypes": true,
"strictNullChecks": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"git-init-tests.ts"
]
}

View File

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