apache / apache/arrow-js

[TS] Typescript compatibility

Open
#130 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
112
Forks
23
Avg merge
21h 18m
Merged PRs (30d)
8

Description

While there are several _versions_ that are Javascript-compatible, the "pure Typescript" version fails to type check.

- It is possible to use specific versions, e.g. `@apache-arrow/es2015-umd`.

- It is also possible to use the "umbrella" import `apache-arrow`.

- However, the `@apache-arrow/ts` import fails to type check with `tsc`.

A sample of errors from one file:

```
../../node_modules/@apache-arrow/ts/schema.ts:46:49 - error TS2345: Argument of type '(Field | undefined)[]' is not assignable to parameter of type 'Field[]'.
Type 'Field | undefined' is not assignable to type 'Field'.
Type 'undefined' is not assignable to type 'Field'.

46 return new Schema<{ [key: string]: K }>(columnIndices.map((i) => this.fields[i]).filter(Boolean), this.metadata);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

../../node_modules/@apache-arrow/ts/schema.ts:64:58 - error TS2532: Object is possibly 'undefined'.

64 metadata: mergeMaps(mergeMaps(new Map(), curFields[i].metadata), f2.metadata)
~~~~~~~~~~~~

../../node_modules/@apache-arrow/ts/schema.ts:129:22 - error TS2532: Object is possibly 'undefined'.

129 const type = field.type;
~~~~~
```

(Is there any plan to have the typescript code eventually type-check with `tsc` ?)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.