Skip to content

JS Interop suggestion: Make JSTypedArray genericΒ #60865

Open
@nex3

Description

@nex3

The JSTypedArray class represents an array that can contain several types of data (from Dart's perspective): integers, floating-point numbers, and 64-bit BigInts. Its subclasses all define an in-depth API for accessing these values, but in order to define interop typings for these APIs and make them accessible from Dart, they'd currently each have to be redefined individually.

If JSTypedArray were made generic, and its subclasses made to inherit from specifically JSTypedArray<JSNumber> or JSTypedArray<BigInt>, these typings could be shared across all subclasses. If JSTypedArray<JSNumber> were further divided into JSTypedIntArray and JSTypedDoubleArray, methods like TypedArray.at() and the indexing operator could be used to directly return the appropriate Dart numeric types.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-web-jsIssues related to JavaScript support for Dart Web, including DDC, dart2js, and JS interop.web-js-interopIssues that impact all js interop

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions