question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support ES5-style inheritance with Object.create (Salsa)

See original GitHub issue

TypeScript Version: 2.4.1

Salsa engine does not understand ES3 prototype inheritance.

Code


function A() {
    
}

A.prototype.hello = function (){
};

function B() {
    A.call(this);
}

B.prototype = Object.create(A.prototype);
B.prototype.constructor = B;

var b = new B();
b.[request completions]

Expected behavior:

It should show the list of methods inherited from A, like hello().

Actual behavior:

It does not show the methods from A.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
PhaserEditor2Dcommented, Sep 21, 2017

The support of @class and @extends could be a simpler solution and a workaround instead of “recognize” the Object.create pattern.

1reaction
DanielRosenwassercommented, Sep 21, 2017

As a matter of fact, we don’t support the @class or @extends annotations either.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Inheritance and the prototype chain - JavaScript | MDN
Supported in all modern engines. Allows the dynamic manipulation of an object's prototype and can even force a prototype on a prototype-less ...
Read more >
gwtproject/gwt - Gitter
This is my favorite thread in terms of flamewars, and apple's rep basically saying, no, we won't ever do is="" inheritance; it is...
Read more >
javascript - What is a practical advantage of Object.create over ...
The most common case for using Object.create is building ES5-style class inheritance, but it can also be used for myriads of other things...
Read more >
What's the Difference Between Class & Prototypal Inheritance ...
Class Inheritance: A class is like a blueprint — a description of the object to be created. Classes inherit from classes and create...
Read more >
Javascript Tutorial Dark Mode | PDF | Java Script | Json - Scribd
16.0.4 Creating objects using function constructors . . . . . . . 184. 17 Prototype 185 ... (JSON string format does not...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found