Fix some types in nodegit

This commit is contained in:
Pierre Vigier 2019-02-28 14:35:25 +01:00
parent 09b9ef4ff0
commit 68d2c7b856
5 changed files with 18 additions and 14 deletions

View File

@ -25,7 +25,7 @@ export class Commit {
static lookupPrefix(repo: Repository, id: Oid, len: number): Promise<Commit>;
static createWithSignature(repo: Repository, commitContent: string, signature: string, signatureField: string): Promise<Oid>;
amend(updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree): Promise<Oid>;
amend(updateRef: string, author: Signature, committer: Signature, messageEncoding: string, message: string, tree: Tree | Oid): Promise<Oid>;
author(): Signature;
committer(): Signature;

View File

@ -132,17 +132,18 @@ export class Diff {
*
*
*/
static blobToBuffer(oldBlob: Blob, oldAsPath: string,
buffer: string, bufferAsPath: string, opts: DiffOptions, fileCb: Function, binaryCb: Function, hunkCb: Function, lineCb: Function): Promise<any>;
static blobToBuffer(oldBlob: Blob | null, oldAsPath: string | null,
buffer: string | null, bufferAsPath: string | null, opts: DiffOptions | null, fileCb: Function | null,
binaryCb: Function | null, hunkCb: Function | null, lineCb: Function): Promise<any>;
static fromBuffer(content: string, contentLen: number): Promise<Diff>;
static indexToWorkdir(repo: Repository, index: Index, opts?: DiffOptions): Promise<Diff>;
static indexToWorkdir(repo: Repository, index: Index | null, opts?: DiffOptions): Promise<Diff>;
static indexToIndex(repo: Repository, oldIndex: Index, newIndex: Index, opts?: DiffOptions): Promise<Diff>;
static treeToIndex(repo: Repository, oldTree: Tree, index: Index, opts?: DiffOptions): Promise<Diff>;
static treeToTree(repo: Repository, oldTree: Tree, new_tree: Tree, opts?: DiffOptions): Promise<Diff>;
static treeToWorkdir(repo: Repository, oldTree: Tree, opts?: DiffOptions): Promise<Diff>;
static treeToWorkdirWithIndex(repo: Repository, oldTree: Tree, opts?: DiffOptions): Promise<Diff>;
static treeToIndex(repo: Repository, oldTree: Tree | null, index: Index | null, opts?: DiffOptions): Promise<Diff>;
static treeToTree(repo: Repository, oldTree: Tree | null, new_tree: Tree | null, opts?: DiffOptions): Promise<Diff>;
static treeToWorkdir(repo: Repository, oldTree: Tree | null, opts?: DiffOptions): Promise<Diff>;
static treeToWorkdirWithIndex(repo: Repository, oldTree: Tree | null, opts?: DiffOptions): Promise<Diff>;
findSimilar(options: DiffFindOptions): Promise<number>;
findSimilar(options?: DiffFindOptions): Promise<number>;
getDelta(idx: number): DiffDelta;
getPerfdata(): Promise<DiffPerfdata>;
numDeltas(): number;

View File

@ -1,6 +1,8 @@
// Type definitions for nodegit 0.24
// Project: https://github.com/nodegit/nodegit, http://nodegit.org
// Definitions by: Dolan Miu <https://github.com/dolanmiu>, Tobias Nießen <https://github.com/tniessen>
// Definitions by: Dolan Miu <https://github.com/dolanmiu>,
// Tobias Nießen <https://github.com/tniessen>,
// Pierre Vigier <https://github.com/pvigier>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export { AnnotatedCommit } from './annotated-commit';

View File

@ -1,8 +1,9 @@
import { AnnotatedCommit } from './annotated-commit';
import { Repository } from './repository';
import { Object } from './object';
import { Strarray } from './str-array';
import { CheckoutOptions } from './checkout-options';
import { Commit } from './commit';
import { Tag } from './tag';
export namespace Reset {
const enum TYPE {
@ -16,11 +17,11 @@ export class Reset {
/**
* Look up a refs's commit.
*/
static reset(repo: Repository, target: Object, resetType: number, checkoutOpts: CheckoutOptions): Promise<number>;
static reset(repo: Repository, target: Commit | Tag, resetType: number, checkoutOpts: CheckoutOptions): Promise<number>;
/**
* Look up a refs's commit.
*/
static default(repo: Repository, target: Object, pathspecs: Strarray | string | string[]): Promise<number>;
static default(repo: Repository, target: Commit | Tag, pathspecs: Strarray | string | string[]): Promise<number>;
/**
* Sets the current head to the specified commit oid and optionally resets the index and working tree to match.
* This behaves like reset but takes an annotated commit, which lets you specify which extended sha syntax string was specified by a user, allowing for more exact reflog messages.

View File

@ -13,7 +13,7 @@ export interface RevertOptions {
}
export class Revert {
static revert(repo: Repository, commit: Commit, givenOpts: RevertOptions): Promise<number>;
static revert(repo: Repository, commit: Commit, givenOpts?: RevertOptions): Promise<number>;
/**
* Reverts the given commit against the given "our" commit, producing an index that reflects the result of the revert.
*/