microsoft / microsoft/TypeScript

Make standard library types more polyfills‑friendly

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

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

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

説明

A significant number of ECMAScript / web standards features that have recently standardized (like Iterator.concat) are still missing from the TypeScript standard library. There are ECMAScript proposals (like Iterator.zip) that are supported by modern browsers but still lack corresponding type definitions. Finally, many projects intentionally target older TypeScript versions with old standard library types.

I am working on types for the core-js polyfill library, which is used on most websites, so it makes a lot of sense to add type definitions for it. While doing this work, I have encountered some significant issues:

  • Some DOM types, for example URL, are declared as ambient variable declarations with type literals in lib.dom.d.ts. This approach does not allow declaration merging. Possible solution: define them via interfaces (like in ECMAScript types) to allow declaration merging.

  • The use of getters/setters. For example, ArrayBuffer defines the detached property via a getter. This makes it impossible to create a compatible polyfill type for different targets. Similar issues often cause conflicts between different type libraries. In most similar cases, accessors are declared as readonly properties, and this does not cause any problems.

If there were some mechanism for conditional type usage, it could make the standard types more polyfills‑friendly.

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

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

はじめの一歩

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

調査の方向性

まず、lib.dom.d.ts の ambient 宣言と src/lib/es2024.arraybuffer.d.ts の ArrayBuffer accessor を、リンクされている core-js および ECMAScript proposal のコンテキストと併せて確認します。標準ライブラリの型を polyfill および古い TypeScript ライブラリターゲットと互換にする、合意済みの仕組みと、それに対応するライブラリの変更があれば完了です。

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

評価

技術スタック
javascript, typescript
領域
compilers
issue の種類
機能追加
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

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

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