-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Closed
Copy link
Labels
DuplicateAn existing issue was already createdAn existing issue was already created
Description
When a tsconfig.json file is used to target a directory instead of an explicit file list, inherited classes aren't guaranteed to be ordered correctly unless they contain /// <reference tags. It would be nice if directory based compilation could work out the order for inherited classes without the need for the extra tags.
eg.
If i have an empty tsconfig.json file:
{}
A base class:
/** Base class */
class ServiceBase {
}
And inheriting class:
/** Child class */
class MyService extends ServiceBase {
constructor(){
super();
}
}
And a project structure like:
ProjectDir
--MyService.ts
--ServiceBase.ts
--tsconfig.json
The output .js will output the child class before the base class which gives runtime errors:
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 __();
};
/** Child class */
var MyService = (function (_super) {
__extends(MyService, _super);
function MyService() {
_super.call(this);
}
return MyService;
})(ServiceBase);
/** Base class */
var ServiceBase = (function () {
function ServiceBase() {
}
return ServiceBase;
})();
If I add a reference comment to my child class, the ordering will be correct:
/// <reference path="ServiceBase.ts"/>
I'd like to not have to do this, since the reference tags no longer seem necessary for most other use cases:
Jweber719Jweber719
Metadata
Metadata
Assignees
Labels
DuplicateAn existing issue was already createdAn existing issue was already created