0
導入枚舉
我有以下兩個文件:bag.js如何打字稿
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);
}
}
和bagType.js
enum BagType {
Canvas,
Paper
}
我的問題是下一個:我怎樣才能導入枚舉BagType到Bag類?
[如何導入枚舉(可能的重複https://stackoverflow.com/questions/38553097/how -en-import-an-enum) – EnverOsmanov