microsoft / microsoft/TypeScript
Support `@extends` tag for ES5-style classes
まだ誰も着手していません。
- 主要言語
- Go
- スター
- 111k
- フォーク
- 14.4k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 117
説明
TypeScript Version: 3.7.5 and 3.8.0-dev.20200123
Search Terms: extends not attached to a class
I'm currently evaluating if TypeScript can be used to type-check old closure compiler projects which use JSDoc annotations for typing and to generate *.d.ts files for it so the old projects can be easily used within new typescript projects. But unfortunately the @extends annotation is not working as expected. I would understand if TypeScript simply didn't support it (Then this would be a feature request) but the error message error TS8022: JSDoc '@extends' is not attached to a class thrown by the compiler suggests that there is some support for but it doesn't work as expected.
Please note that the real class inheritance code which actually extends class Sub from Base is omitted in the code example below because it is irrelevant to the compiler.
Code
// Compile with: tsc --checkJS --allowJS --outDir out test.js
/**
* @constructor
* @class
*/
function Base() {}
Base.prototype.foo = function() {}
/**
* @constructor
* @class
* @extends {Base}
*/
function Sub() {}
Sub.prototype.bar = function() {}
Expected behavior:
Typescript should recognize type Sub to be a class which extends class Base.
Actual behavior:
Compilation fails with this error:
$ tsc --checkJS --allowJS --outDir out test.js
test.js:14:10 - error TS8022: JSDoc '@extends' is not attached to a class.
14 function Sub() {}
~~~
Found 1 error.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
まず、報告されている tsc --checkJS --allowJS コマンドを test.js に対して再現し、ES5 スタイルのコンストラクターにおける JSDoc @extends のコンパイラーによる処理を追跡します。完了の条件は、例が TS8022 なしでコンパイルされ、TypeScript が Sub が Base を継承していると認識し、このケースのカバレッジがあることです。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- javascript, typescript
- 領域
- compilers
- issue の種類
- 機能追加
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 35/100