microsoft / microsoft/TypeScript

HTMLCollection should be string indexable

オープン
#19,437 コメント 5 件 リアクション 12 件 担当者 0 名 GitHub で見る

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

Awaiting More Feedback Domain: lib.d.ts Suggestion
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
2日 4時間
マージ済み PR(30日)
132

説明

According to MDN, HTMLCollection should be string indexable:

HTMLCollection also exposes its members directly as properties by both name and index. HTML IDs may contain : and . as valid characters, which would necessitate using bracket notation for property access. Currently HTMLCollections does not recognize purely numeric IDs, which would cause conflict with the array-style access, though HTML5 does permit these.

TypeScript Version: master

Code

declare const elements: HTMLCollection;
elements['myId'] // implicit any error, where it should be the same type as elements[0].

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

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

はじめの一歩

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

調査の方向性

まず、TypeScript の標準ライブラリ定義にある HTMLCollection の宣言を見つけ、数値プロパティアクセスと名前付きプロパティアクセスを比較します。issue のコード例を使って、文字列によるインデックスアクセスが数値によるインデックスアクセスと同じ要素型を生成することを確認します。名前付きアクセスだけで暗黙の any エラーが報告されなくなれば完了です。

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

評価

技術スタック
html, typescript
領域
web-dev
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

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

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