microsoft / microsoft/TypeScript

Convert to ES2015 class do not recognize inheritance

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

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

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

説明

Issue Type: Bug

function Derived() {
  Base.call(this, /*some base args*/);
  /* some other constructor work */
};
Derived.prototype = new Base();
Derived.prototype.constructor = Derived;

must be converted to

class Derived extends Base {
  constructor() {
    super(/*some base args*/);
    /* some other constructor work */
  }
}

Right now it converted to

class Derived {
  constructor() {
    Base.call(this, /*some base args*/);
    /* some other constructor work */
  }
}
;
Derived.prototype = new Base();
Derived.prototype.constructor = Derived;

VS Code version: Code 1.36.1 (2213894ea0415ee8c85c5eea0d0ff81ecc191529, 2019-07-08T22:59:35.033Z)
OS version: Windows_NT x64 10.0.17134

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (8 x 1992)
GPU Status 2d_canvas: enabled
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
native_gpu_memory_buffers: disabled_software
oop_rasterization: disabled_off
protected_video_decode: enabled
rasterization: enabled
skia_deferred_display_list: disabled_off
skia_renderer: disabled_off
surface_synchronization: enabled_on
video_decode: enabled
viz_display_compositor: disabled_off
webgl: enabled
webgl2: enabled
Load (avg) undefined
Memory (System) 7.89GB (2.36GB free)
Process Argv
Screen Reader no
VM 0%
Extensions (14)
Extension Author (truncated) Version
search-crates-io bel 1.2.1
better-toml bun 0.3.2
bracket-pair-colorizer-2 Coe 0.0.28
pegjs-syntax fut 0.1.1
nwscript glo 0.0.2
restructuredtext lex 112.0.0
hg mrc 1.3.0
vscode-language-pack-ru MS- 1.36.2
rust rus 0.6.1
crates ser 0.4.3
vscode-hexdump sle 1.7.2
code-spell-checker str 1.7.17
code-spell-checker-russian str 0.2.2
sort-lines Tyr 1.8.0

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

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

はじめの一歩

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

調査の方向性

レポートにある関数ベースの Derived と Base の例を使って VS Code で変換を再現し、次に JavaScript-to-ES2015 クラス変換のエントリーポイントを追跡します。結果が class Derived extends Basesuper(...) を使用し、プロトタイプへの代入を残すのではなく、コンストラクター内のその他の処理を保持していれば完了です。

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

評価

技術スタック
javascript, typescript
領域
tooling
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

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

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