मुझे कुछ जावास्क्रिप्ट कोड का परीक्षण करते समय निम्न त्रुटि मिलती है, टाइपस्क्रिप्ट फ़ाइल से ट्रांसफर किया जाता है।त्रुटि: * .default एक कन्स्ट्रक्टर नहीं है
इसे हल करने के लिए मैं क्या कर सकता हूं?
var mapAction = new MapAction(MapActionType.POLYGONDRAGGED, []);
यहाँ मूल टाइपप्रति-फ़ाइल नक्शे-action.ts है:
Error: _mapAction2.default is not a constructor
यहाँ कि त्रुटि के कारण कोड की पंक्ति है:
यहाँ त्रुटि है :
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;
}
}
"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
अग्रिम धन्यवाद: 0 यहाँ transpiled .js फ़ाइल नक्शे-action.js है!
export default class MapAction implements IMapAction {...
और के रूप में आयात:
import MapAction from './map_action_file';
वैकल्पिक रूप से, अगर आप से कई बातें निर्यात करना चाहते हैं
या वैकल्पिक रूप से, 'आयात से {MapAction} '/ डिफ़ॉल्ट – Ksyqo
निर्यात के बिना map_action_file'' धन्यवाद yev, मैं एक है, और फिर में सभी map_action से संबंधित फाइलों विलय कर दिया @ Ksygo की टिप्पणी त्रुटि तय! – ChristopherMortensen
{} की कमी मुझे प्राप्त कर रही थी: 'आयात/फ्रैक}' ./Frak 'से; 'इसे ठीक किया गया। धन्यवाद। – RyanNerd