microsoft / microsoft/TypeScript

Convert to ES2015 class do not recognize inheritance

Open
#32,491 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Awaiting More Feedback Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the conversion in VS Code with the function-based Derived and Base example from the report, then trace the JavaScript-to-ES2015 class conversion entry point. Done means the result uses class Derived extends Base and super(...) while preserving the other constructor work, rather than leaving prototype assignments behind.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.