microsoft / microsoft/TypeScript

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

オープン 初心者向け
#63,832 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Possible Improvement
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

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.

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

internal/bundled/libs/lib.es2015.iterable.d.ts#L107 から始めて、Array.from と TypedArray.from の mapFn 宣言を見つけます。パラメーター名をリンク先の MDN の説明と比較し、両方の宣言が型や動作を変更せずに、要素とインデックスに説明的な名前を使用していることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
typescript
領域
tooling
issue の種類
リファクタリング
難易度
1/5
見積もり時間
1時間未満
活発さ
活発
明瞭さ
明確に書かれている
初心者へのやさしさ
88/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。