Skip to content

[TS] Typescript compatibility #130

@agam

Description

@agam

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<T[keyof T]> | undefined)[]' is not assignable to parameter of type 'Field<any>[]'.
  Type 'Field<T[keyof T]> | undefined' is not assignable to type 'Field<any>'.
    Type 'undefined' is not assignable to type 'Field<any>'.

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 ?)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions