Whenever I attempt to establish inheritance in TypeScript, the following JavaScript code is generated:
var __extends = (this && this.__extends) || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
The generated code appears to be correct. However, a problem arises when running it in Firefox, as it throws the following error message:
TypeError: b is undefined
In Chrome, the error message has a slight variation but seems to stem from the same issue:
Uncaught TypeError: Cannot read property 'prototype' of undefined
The TypeScript implementation is structured like this:
class Movie extends Medium {
//Fields
constructor(title: string, description: string, ageRestriction: AgeRestriction, isBluRay: boolean) {
super(title, description, ageRestriction);
this.isBluRay = isBluRay;
}
}
class Medium implements IMedium {
//Getters, Setters, and Fields
constructor(title: string, description: string, ageRestriction: AgeRestriction) {
this.title = title;
this.description = description;
this.ageRestriction = ageRestriction;
}
}
I have attempted various methods of compiling the code, yet the outcome remains consistent.