-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
ExternalRelates to another program, environment, or user action which we cannot control.Relates to another program, environment, or user action which we cannot control.
Description
I know native types should be extendable since this PR #3516 , but I can't seem to get extending ES6 Map to work.
The following code
class ResourceMap extends Map {}
var x = new ResourceMap();
x.set('foo',true);
compiles correctly to:
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 __());
};
var ResourceMap = (function (_super) {
__extends(ResourceMap, _super);
function ResourceMap() {
_super.apply(this, arguments);
}
return ResourceMap;
}(Map));
//[...]
var x = new ResourceMap();
x.set('foo',true);
But when I run it in chrome it gives an error Uncaught TypeError: Constructor Map requires 'new'
When I run the original typescript code directly in the chrome console (which is possible because it's also valid ES6 and only uses functions supported by chrome) then it works correctly. So it should be possible?
Is there a way to extend ES6 Map from Typescript?
jaibatrik, DanielKucal, achimbode, BOPOHOB, pmunin and 10 more
Metadata
Metadata
Assignees
Labels
ExternalRelates to another program, environment, or user action which we cannot control.Relates to another program, environment, or user action which we cannot control.