Support ES5-style inheritance with Object.create (Salsa)
See original GitHub issueTypeScript 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:
- Created 6 years ago
- Reactions:1
- Comments:5 (3 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The support of
@class
and@extends
could be a simpler solution and a workaround instead of “recognize” theObject.create
pattern.As a matter of fact, we don’t support the
@class
or@extends
annotations either.