microsoft / microsoft/TypeScript
Extract types from definition file
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
Search Terms
extract d.ts definition types
Suggestion
For a tvOS project I'm working with TVML and TypeScript. The JavaScript environment has some of the functionality of the browser, but not all classes are available (like FormData and URL).
You can see the classes that are supported here:
https://developer.apple.com/documentation/tvmljs
What I would like to do is to import a subset of type definitions from lib.dom.d.ts and then export them as lib.tvml.d.ts
Unfortunately I can't simply create a d.ts file and write this:
export { XMLHttpRequest } from "typescript/lib/lib.dom"
My next thought was to create a copy of lib.dom.d.ts and to remove everything except for the classes supported by TVML. However some of the types (like Document) are huge and they depend on other types which makes it even more complicated.
Another downside of a copy would be that it would miss out on the improvements that will be made over time to lib.dom.d.ts.
Use Cases
The file lib.webworker.d.ts has some overlap with lib.dom.d.ts (things like XMLHttpRequest). If we could create a d.ts by importing definitions from another d.ts it could simplify the built-in library definitions.
It also offers developers an easy way to pick which definitions are allowed to be used in the project.
Examples
See example under Suggestion section.
Checklist
My suggestion meets these guidelines:
- This wouldn't be a breaking change in existing TypeScript/JavaScript code
- This wouldn't change the runtime behavior of existing JavaScript code
- This could be implemented without emitting different JS based on the types of the expressions
- This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)
- This feature would agree with the rest of TypeScript's Design Goals.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず lib.dom.d.ts と lib.webworker.d.ts を比較し、その後、参照されている TVMLJS API リストを確認します。lib.dom.d.ts をコピーせずに、選択した定義とその依存関係をどのように公開するかを定義します。重複する定義のユースケースと TVML 固有のサブセットの両方がサポートされれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 30/100