microsoft / microsoft/TypeScript

Please document compiler APIs

オープン
#34,890 コメント 2 件 リアクション 8 件 担当者 0 名 GitHub で見る

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

Docs
主要言語
Go
スター
111k
フォーク
14.3k
平均マージ
1日 19時間
マージ済み PR(30日)
117

説明

Would it be possible to get some documentation on the compiler APIs?

I am working on some TypeScript tooling, and I am using ts.createSourceFile() to get the AST for a TypeScript source file. However, the tree in SourceFile.statements is missing some information. For example, I need to know the type of an Expression when a PropertyDeclaration only has an initializer but no declared type. I have tried TypeChecker.getContextualType() but it always returns undefined; also the implementation doesn't look right. There are internal methods like TypeChecker.getTypeOfExpression() that look promising, but they are not visible. Also I read some mention of 'bindings', but I haven't found a way to get them.

Another example is type resolution: When I encounter a TypeNode or something similar within the AST, I usually need to know about its declaration: Where does it come from? Is it local? Where is it imported from? Of course I can write that myself with some effort, but surely such logic already exists within the compiler, I just don't know where.

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

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

はじめの一歩

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

調査の方向性

まず、issue で挙げられているコンパイラ API の領域を確認します: ts.createSourceFile()、SourceFile.statements、TypeChecker.getContextualType()、getTypeOfExpression()、bindings、型解決。式の型と宣言を取得するためにサポートされている公開 API を、imports とローカル宣言の識別方法を含めて文書化します。これらのワークフローが TypeScript ツールの作者向けに明確に説明されていれば完了です。

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

評価

技術スタック
typescript
領域
compilers, documentation
issue の種類
ドキュメント
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
20/100

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

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