When I try to create inheritance in TypeScript, the following JavaScript 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 __()); };
Which looks exactly like the one that needs to be generated. But the problem is that when executed, Firefox gives this message:
TypeError: b is undefined
In Chrome, the error looks a little different, but it seems to have the same origin:
Uncaught TypeError: Cannot read property 'prototype' of undefined
An implementation in TypeScript looks like this:
class Movie extends Medium {
I already tried various ways to compile the code, but the result is always the same
source share