mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-06 07:47:04 +00:00
@@ -0,0 +1,43 @@
|
||||
import firstCommit = require('gfc');
|
||||
|
||||
firstCommit({ cwd: 'foo/bar' }); // $ExpectType Promise<{ stdout: string | Buffer; stderr: string | Buffer; }>
|
||||
firstCommit({ exec: { encoding: 'buffer' } }); // $ExpectType Promise<{ stdout: string | Buffer; stderr: string | Buffer; }>
|
||||
firstCommit({ exec: { input: 'foo' } }); // $ExpectError
|
||||
firstCommit({ message: 'foo' }); // $ExpectType Promise<{ stdout: string | Buffer; stderr: string | Buffer; }>
|
||||
firstCommit({ file: false }); // $ExpectType Promise<{ stdout: string | Buffer; stderr: string | Buffer; }>
|
||||
firstCommit({ file: { path: 'foo' } }); // $ExpectType Promise<{ stdout: string | Buffer; stderr: string | Buffer; }>
|
||||
firstCommit({ file: { path: 'foo', contents: 'bar' } }); // $ExpectType Promise<{ stdout: string | Buffer; stderr: string | Buffer; }>
|
||||
firstCommit({ commit: false }); // $ExpectType Promise<{ stdout: string | Buffer; stderr: string | Buffer; }>
|
||||
firstCommit({ forceFile: false }); // $ExpectType Promise<{ stdout: string | Buffer; stderr: string | Buffer; }>
|
||||
firstCommit({ remote: 'foo' }); // $ExpectType Promise<{ stdout: string | Buffer; stderr: string | Buffer; }>
|
||||
firstCommit({ push: false }); // $ExpectType Promise<{ stdout: string | Buffer; stderr: string | Buffer; }>
|
||||
|
||||
firstCommit().then(res => {
|
||||
res.stdout; // $ExpectType string | Buffer
|
||||
res.stderr; // $ExpectType string | Buffer
|
||||
});
|
||||
firstCommit('foo/bar').then(res => {
|
||||
res.stdout; // $ExpectType string | Buffer
|
||||
res.stderr; // $ExpectType string | Buffer
|
||||
});
|
||||
firstCommit('foo/bar', { cwd: 'foo/bar' }).then(res => {
|
||||
res.stdout; // $ExpectType string | Buffer
|
||||
res.stderr; // $ExpectType string | Buffer
|
||||
});
|
||||
// $ExpectType void
|
||||
firstCommit('foo/bar', (err, stdout, stderr) => {
|
||||
err; // $ExpectType ExecException | null
|
||||
stdout; // $ExpectType string | Buffer
|
||||
stderr; // $ExpectType string | Buffer
|
||||
});
|
||||
// $ExpectType void
|
||||
firstCommit('foo/bar', { cwd: 'foo/bar' }, (err, stdout, stderr) => {
|
||||
err; // $ExpectType ExecException | null
|
||||
stdout; // $ExpectType string | Buffer
|
||||
stderr; // $ExpectType string | Buffer
|
||||
});
|
||||
|
||||
firstCommit.sync(); // $ExpectType string | Buffer
|
||||
firstCommit.sync('foo/bar'); // $ExpectType string | Buffer
|
||||
firstCommit.sync('foo/bar', { exec: { input: 'foo' } }); // $ExpectType string | Buffer
|
||||
firstCommit.sync({ exec: { input: 'foo' } }); // $ExpectType string | Buffer
|
||||
Vendored
+54
@@ -0,0 +1,54 @@
|
||||
// Type definitions for gfc 2.0
|
||||
// Project: https://github.com/jonschlinkert/gfc
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.1
|
||||
|
||||
/// <reference types="node" />
|
||||
|
||||
import { ExecOptions, ExecException, ExecSyncOptions } from 'child_process';
|
||||
|
||||
export = gitFirstCommit;
|
||||
|
||||
declare function gitFirstCommit(
|
||||
options?: gitFirstCommit.Options<gitFirstCommit.ExecOptionsWithEncoding>
|
||||
): Promise<{ stdout: string | Buffer; stderr: string | Buffer }>;
|
||||
declare function gitFirstCommit(
|
||||
cwd: string,
|
||||
options?: gitFirstCommit.Options<gitFirstCommit.ExecOptionsWithEncoding>
|
||||
): Promise<{ stdout: string | Buffer; stderr: string | Buffer }>;
|
||||
declare function gitFirstCommit(
|
||||
cwd: string,
|
||||
callback: (
|
||||
error: ExecException | null,
|
||||
stdout: string | Buffer,
|
||||
stderr: string | Buffer
|
||||
) => void
|
||||
): void;
|
||||
declare function gitFirstCommit(
|
||||
cwd: string,
|
||||
options: gitFirstCommit.Options<gitFirstCommit.ExecOptionsWithEncoding>,
|
||||
callback: (
|
||||
error: ExecException | null,
|
||||
stdout: string | Buffer,
|
||||
stderr: string | Buffer
|
||||
) => void
|
||||
): void;
|
||||
|
||||
declare namespace gitFirstCommit {
|
||||
function sync(options?: Options<ExecSyncOptions>): string | Buffer;
|
||||
function sync(cwd: string, options?: Options<ExecSyncOptions>): string | Buffer;
|
||||
|
||||
type ExecOptionsWithEncoding = { encoding?: BufferEncoding | 'buffer' | null } & ExecOptions;
|
||||
|
||||
interface Options<TExecOptions> {
|
||||
cwd?: string;
|
||||
exec?: TExecOptions;
|
||||
message?: string;
|
||||
file?: { path: string; contents?: string } | false;
|
||||
commit?: boolean;
|
||||
forceFile?: boolean;
|
||||
remote?: string;
|
||||
push?: boolean;
|
||||
}
|
||||
}
|
||||
@@ -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",
|
||||
"gfc-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user