microsoft / microsoft/TypeScript
Compiler API: Expose More from typescript.d.ts
オープン
まだ誰も着手していません。
Domain: API
Help Wanted
Suggestion
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
TypeScript Version: 2.9.0-dev.20180426
While Traversing the TypeScript AST of a source file, there have been a number of helpful things I've found by extending ts.* from typescript.d.ts and I would like it if these could be exposed (or not marked /* @internal */).
Search Terms:
typescript.d.ts
Node.locals
Symbol.parent
getContainingFunction
isAssignmentTarget
Code
declare namespace ts {
interface Node {
/* @internal */ readonly locals?: SymbolTable; // Locals associated with node (initialized by binding)
}
interface Symbol {
/* @internal */ readonly parent?: Symbol; // Parent symbol
}
function getContainingFunction(node: Node): SignatureDeclaration | undefined;
function isAssignmentTarget(node: Node): boolean;
}
Note:
- Added
readonlyforNode#locals&Symbol#parent - For
Symbol#parent, the goal is: given the symbol for a method (e.g.,methodSymbolforNumber#toString) find where that method is defined (e.g.,Number)... maybeprogram.getTypeChecker().getSymbolAtLocation(methodSymbol.valueDeclaration.parent)is what is "supposed" to be used instead? - For
ts.getContainingFunction()it seems more appropriate to have a return type ofSignatureDeclaration | undefinedinstead ofSignatureDeclaration
Related Issues:
#15841
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
typescript.d.ts の公開宣言から始め、記載されているメンバー Node.locals、Symbol.parent、getContainingFunction、isAssignmentTarget と、それらに対応するコンパイラー実装を比較します。API と戻り値の型に関して提示されている疑問を解決し、そのうえで、意図されたメンバーが Compiler API の利用者に対して一貫して公開されていることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- typescript
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 30/100