0
Ich habe die folgenden zwei Dateien: bag.jsWie Enum importieren in Typoskript
import {BagType} from "./bagType" //this line of code gives an error message: bagtype.ts is not a modul
import {Present} from "./present";
export class Bag {
private maxWeight: number;
private bagType: BagType;
private presents: Array<Present> = new Array<Present>();
constructor(maxWeight: number, bagType: BagType) {
this.maxWeight = maxWeight;
this.bagType = bagType;
}
public addPresent(present: Present){
this.presents.push(present);
}
}
und bagType.js
enum BagType {
Canvas,
Paper
}
Meine Frage ist die nächste: Wie kann ich importieren Sie die Enum BagType zur Bag-Klasse?
Mögliche Duplikat von [Wie ein Enum importieren] (https://stackoverflow.com/questions/38553097/how -to-import-an-enum) – EnverOsmanov