我正在使用 Meteor 和 TypeScript 开发一个 Web 应用程序,也使用 Nitrous.io 环境。
我正在尝试实现用户帐户系统。我正在调整我在旧项目中的 JavaScript 代码(它有效),但我仍然遇到错误。这来自login.ts文件:
// retrieve the input field values
var email = template.$('[name=email]').val();
var password = template.$('[name=password]').val();
var errors = {};
if (! email) {
errors.email = 'Please enter your email address'; // ERROR HERE
}
if (! password) {
errors.password = 'Please enter your password'; // ERROR HERE
}
我收到的错误消息是:
/client/login.ts(41,20): error TS2094: The property 'email' does not exist on value of type '{}'.
/client/login.ts(45,20): error TS2094: The property 'password' does not exist on value of type '{}'.
有任何想法吗?谢谢。:)