Skip to content

[Post-7.0] Improve readability of Array.from / TypedArray.from mapFn parameters #4236

@AXT-AyaKoto

Description

@AXT-AyaKoto

Currently, the mapFn argument of Array.from() is typed as (v: T, k: number) => U.
However, when this information is displayed in an IDE tooltip, it is difficult to grasp what values are passed to v and k.

To improve clarity, I propose changing the type definition to (element: T, index: number) => U, following the description of the same method in MDN Web Docs. The same applies to TypedArray.from().

Supplementary Information:

  • The target file is internal/bundled/libs/lib.es2015.iterable.d.ts#L107.
  • These changes are not intended to fix differences between 6.0 and 7.0, and according to CONTRIBUTING.md, the Pull Request should be submitted after the 7.0 release. I plan to submit a Pull Request for this once 7.0 is released.

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