From 889f9de5f934cbd27f1860e4c3487719472372f8 Mon Sep 17 00:00:00 2001 From: Frederic Junod Date: Tue, 23 Oct 2018 09:50:38 +0200 Subject: [PATCH] [pbf] Add ArrayBuffer to the constructor argument type In addition to `Uint8Array`, the `buffer` can be an `ArrayBuffer`. See: https://github.com/mapbox/pbf/blob/v3.0.0/index.js#L8 --- types/pbf/index.d.ts | 2 +- types/pbf/pbf-tests.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/types/pbf/index.d.ts b/types/pbf/index.d.ts index fdcb9b53ce..692ca491bf 100644 --- a/types/pbf/index.d.ts +++ b/types/pbf/index.d.ts @@ -9,7 +9,7 @@ declare class Pbf { type: number; length: number; - constructor(buffer?: Uint8Array); + constructor(buffer?: Uint8Array|ArrayBuffer); destroy(): void; readFields(readField: (tag: number, result?: T, pbf?: Pbf) => void, result?: T, end?: number): T; diff --git a/types/pbf/pbf-tests.ts b/types/pbf/pbf-tests.ts index c0a8556c42..f6914f5e13 100644 --- a/types/pbf/pbf-tests.ts +++ b/types/pbf/pbf-tests.ts @@ -2,6 +2,7 @@ import Pbf = require('pbf'); const pbf = new Pbf(new Uint8Array(1)); new Pbf(); +new Pbf(new ArrayBuffer(8)); pbf.buf; pbf.pos; pbf.type;