I run the following typescript code in the target ES6 environment and it says "Cars are not constructors"
I followed the link and tried to change the target environment to ES5. It is working fine. Can someone tell me why it is not working for the target ES6.
Here is my typescript code:
export class Cars { constructor(public len: number,public wid: number) { } } export function getSize(): Cars { return new Cars(20, 30); };
Error: "Cars are not constructors" in the getSize function.
By the way, I am trying to download all files using Systemjs.
By the way, I get an error message in the browser ........ I am not compiling it ...
Here is the compiled code above typescript ....
System.register([], function(exports_1, context_1) { "use strict"; var __moduleName = context_1 && context_1.id; var Cars; function getSize() { return new Cars(20, 30); } exports_1("getSize", getSize); return { setters:[], execute: function() { class Cars { constructor(len, wid) { this.len = len; this.wid = wid; } } ; exports_1("Cars", Cars); } } });
source share