最佳答案
当测试从打印脚本文件中传输的一些 javascript 代码时,我得到了以下错误。
这里有一个错误:
Error: _mapAction2.default is not a constructor
下面是导致错误的代码行:
var mapAction = new MapAction(MapActionType.POLYGONDRAGGED, []);
下面是原始打印文件 地图行动:
import { IMapAction} from './imap-action';
import { MapActionType } from './map-action-type.enum';
import {LatLngLiteral} from 'angular2-google-maps/core';
export class MapAction implements IMapAction{
type: MapActionType;
paths: Array<LatLngLiteral>;
constructor(mapActionType: MapActionType, paths: Array<LatLngLiteral>){
this.type = mapActionType;
this.paths = paths;
}
public getType(): MapActionType{
return this.type;
}
public getPaths(): Array<LatLngLiteral>
{
return this.paths;
}
}
下面是已翻译的. js-file Map-action. js:
"use strict";
class MapAction {
constructor(mapActionType, paths) {
this.type = mapActionType;
this.paths = paths;
}
getType() {
return this.type;
}
getPaths() {
return this.paths;
}
}
exports.MapAction = MapAction;
//# sourceMappingURL=map-action.js.map