I put the following code to babel:
class Animal {}
class Rabbit extends Animal {}
And it transpiles it to the following:
"use strict";
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
var Animal = function Animal() {};
var Rabbit =
/*#__PURE__*/
function(_Animal) {
_inheritsLoose(Rabbit, _Animal);
function Rabbit() {
return _Animal.apply(this, arguments) || this;
}
return Rabbit;
}(Animal);
The question is why does it use this line subClass.__proto__ = superClass; and according to docs __proto__ could be either object or null but here superClass is a function.
My question is not duplicate since, I'm not asking about object.prototype=function.prototype, but why __proto__ = typeof function instead of object or null as in spec