From 158b37a44f18435c433a679d1a9d88294eacc34c Mon Sep 17 00:00:00 2001 From: Benjamin Schuster-Boeckler Date: Fri, 3 Jan 2020 00:11:55 +0100 Subject: [PATCH] Fixed incorrect types in nodegit class DiffDelta and Blob (#41314) * Fixes incorrect return types in diff-delta and blob. Should be functions, not direct accessor properties. Also, `rawcontent` returns a wrapper around a Buffer, not a Buffer directly, as `content` does. * updated package description and version * fixed missing argument * Updates jackrabbit types to export namespace for interface and type access. Adds missing options and arguments to a few methods. * fixed linting issue * revert changes to jackrabbit --- types/nodegit/blob.d.ts | 4 ++-- types/nodegit/diff-delta.d.ts | 12 ++++++------ types/nodegit/index.d.ts | 3 ++- types/nodegit/wrapper.d.ts | 3 +++ 4 files changed, 13 insertions(+), 9 deletions(-) create mode 100644 types/nodegit/wrapper.d.ts diff --git a/types/nodegit/blob.d.ts b/types/nodegit/blob.d.ts index cece48a54d..1b8b09e305 100644 --- a/types/nodegit/blob.d.ts +++ b/types/nodegit/blob.d.ts @@ -1,5 +1,5 @@ import { WriteStream } from 'fs'; - +import { Wrapper } from "./wrapper"; import { Repository } from './repository'; import { Oid } from './oid'; @@ -31,7 +31,7 @@ export class Blob { id(): Oid; isBinary(): number; owner(): Repository; - rawcontent(): Buffer; + rawcontent(): Wrapper; rawsize(): number; content(): Buffer; toString(): string; diff --git a/types/nodegit/diff-delta.d.ts b/types/nodegit/diff-delta.d.ts index c21d98f430..2afda666b5 100644 --- a/types/nodegit/diff-delta.d.ts +++ b/types/nodegit/diff-delta.d.ts @@ -1,10 +1,10 @@ import { DiffFile } from './diff-file'; export class DiffDelta { - status: number; - flags: number; - similarity: number; - nfiles: number; - oldFile: DiffFile; - newFile: DiffFile; + status: () => number; + flags: () => number; + similarity: () => number; + nfiles: () => number; + oldFile: () => DiffFile; + newFile: () => DiffFile; } diff --git a/types/nodegit/index.d.ts b/types/nodegit/index.d.ts index 81004f099b..a650ee1f05 100644 --- a/types/nodegit/index.d.ts +++ b/types/nodegit/index.d.ts @@ -1,9 +1,10 @@ -// Type definitions for nodegit 0.24 +// Type definitions for nodegit 0.26 // Project: https://github.com/nodegit/nodegit, http://nodegit.org // Definitions by: Dolan Miu , // Tobias Nießen , // Pierre Vigier // Jibril Saffi +// Benjamin Schuster-Boeckler // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped export { AnnotatedCommit } from './annotated-commit'; diff --git a/types/nodegit/wrapper.d.ts b/types/nodegit/wrapper.d.ts new file mode 100644 index 0000000000..8982280acf --- /dev/null +++ b/types/nodegit/wrapper.d.ts @@ -0,0 +1,3 @@ +export class Wrapper { + toBuffer(bufSize: number): Buffer; +}