What's with the extends
TypeScript generates it to assist with inheritance. ie. class A extends B
will result in the extends function being added.
why does the define not pull in the 4 imports? They are used in the code.
I don't believe they are used in the code. Ensure you have something like:
import listBody = require('./document/list-body');
var foo = listBody; // this will ensure code gen.
Your error `Unable to get property 'prototype' of undefined or null reference comm.js is reflecting to this fact. You are trying to extend something that isn't loaded (is missing in the generated define) because TypeScript thinks it isn't needed at runtime.
Local test
I have verified that the code generated by TypeScript is correct if it notices an extend
.
foo.ts:
class Foo{}
export = Foo;
bar.ts:
import Foo = require('./foo');
class Bar extends Foo{}
compile:
tsc --module amd bar.ts
Generated bar.js:
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
function __() { this.constructor = d; }
__.prototype = b.prototype;
d.prototype = new __();
};
define(["require", "exports", './foo'], function(require, exports, Foo) {
var Bar = (function (_super) {
__extends(Bar, _super);
function Bar() {
_super.apply(this, arguments);
}
return Bar;
})(Foo);
});