mã bên dưới làm cho tôi bởi transpiling nó với ngụm lỗi này:nguyên cảo Compile Lỗi Không thể gọi một biểu thức có loại thiếu một chữ ký cuộc gọi
[tsc] > C:/Workarea/MyFirstAngular/src/enum/msg.ts(35,33): error TS2349: Cannot invoke an expression whose type lacks a call signature. Failed to compile TypeScript: Error: tsc command has exited with code:2
module MessageUtil {
enum Morning {
"Good Morning",
"Great to see you!",
"Good day.",
"Lovely day today, isn't it?",
"What's up?",
"Nice to meet you",
}
}
export class MessageData {
private getRandomElementOfEnum(e : any):string{
var length:number = Object.keys(e).length(); //<-- This is Line 35
return e[Math.floor((Math.random() * length)+1)];
}
public getRandMorning():string {
return this.getRandomElementOfEnum(Morning);
}
}
}
Không ai biết chính xác lỗi của tôi là gì?
Điều tương tự đã hoạt động một lần nhưng sau một vài thay đổi, nó không thể biên dịch được nữa.
Cài đặt của tôi: -IDEA 14 -Node.js -Gulp -gulp-tsc -gulp kết nối (ví Livereload)
Có phải điều chính xác cùng và được ngồi đó stairing vào nó trong khoảng 20 phút tự hỏi ... – Hector