From 74e828afc46b429f1afeff1d00c768b31a6db746 Mon Sep 17 00:00:00 2001 From: Paul Taylor Date: Wed, 10 Jan 2018 19:36:43 -0800 Subject: [PATCH] fix typings issues (ARROW-1903) --- js/src/text-encoding-utf-8.d.ts | 4 ---- js/src/vector/numeric.ts | 7 ++++--- js/src/vector/virtual.ts | 2 +- js/test/Arrow.ts | 2 +- js/test/integration/validate-tests.ts | 2 +- 5 files changed, 7 insertions(+), 10 deletions(-) delete mode 100644 js/src/text-encoding-utf-8.d.ts diff --git a/js/src/text-encoding-utf-8.d.ts b/js/src/text-encoding-utf-8.d.ts deleted file mode 100644 index 68ba4dfd9a346..0000000000000 --- a/js/src/text-encoding-utf-8.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -declare module 'text-encoding-utf-8' { - import * as TextEncoding from 'text-encoding'; - export = TextEncoding; -} diff --git a/js/src/vector/numeric.ts b/js/src/vector/numeric.ts index fe4767809f465..830d6082bcc4a 100644 --- a/js/src/vector/numeric.ts +++ b/js/src/vector/numeric.ts @@ -34,10 +34,10 @@ export class NumericVector extends Vector { concat(...vectors: Vector[]): Vector { return new VirtualVector(this.data.constructor as TypedArrayConstructor, this, ...vectors); } - slice(start?: number, end?: number) { + slice(start?: number, end?: number): R { const { data, stride } = this, from = start! | 0; const to = end === undefined ? data.length : Math.max(end | 0, from); - return data.subarray(Math.min(from, to) * stride | 0, to * stride | 0); + return data.subarray(Math.min(from, to) * stride | 0, to * stride | 0) as any as R; } } @@ -49,7 +49,8 @@ export class FixedWidthNumericVector extends Numer export class BoolVector extends NumericVector { static pack(values: Iterable) { - let xs = [], n, i = 0; + let n = 0, i = 0; + let xs: number[] = []; let bit = 0, byte = 0; for (const value of values) { value && (byte |= 1 << bit); diff --git a/js/src/vector/virtual.ts b/js/src/vector/virtual.ts index 6ec3a8eef9f4d..42db78706db51 100644 --- a/js/src/vector/virtual.ts +++ b/js/src/vector/virtual.ts @@ -93,7 +93,7 @@ export class VirtualVector implements Vector { // this is a significant improvement as we avoid the memcpy 🎉 if ((source.length / vector.stride | 0) < total) { let vectorsLength = vectors.length; - let count = 0, length = 0, sources = []; + let count = 0, length = 0, sources = [] as any[]; do { sources.push(source); length += source.length; diff --git a/js/test/Arrow.ts b/js/test/Arrow.ts index 87641e52bf3f8..f2c4e930f92e4 100644 --- a/js/test/Arrow.ts +++ b/js/test/Arrow.ts @@ -16,7 +16,7 @@ // under the License. /* tslint:disable */ -// Dynamically load an Ix target build based on command line arguments +// Dynamically load an Arrow target build based on command line arguments const path = require('path'); const target = process.env.TEST_TARGET!; diff --git a/js/test/integration/validate-tests.ts b/js/test/integration/validate-tests.ts index c8778ba2b33c2..c612d62ad0c04 100644 --- a/js/test/integration/validate-tests.ts +++ b/js/test/integration/validate-tests.ts @@ -37,7 +37,7 @@ const arrowBuffers: Uint8Array[] = [fs.readFileSync(arrowPath)]; import Arrow from '../Arrow'; import { zip } from 'ix/iterable/zip'; -import { toArray } from 'ix/iterable/toArray'; +import { toArray } from 'ix/iterable/toarray'; const { Table, read } = Arrow;