我很困惑。我有以下javascript文件:
module.exports = {
connection: 'freshairMysqlServer',
tableName: 'Accounts',
autoCreatedAt: false,
autoUpdatedAt: false,
autoPK: false,
attributes: {
idAccounts: {
type: 'integer',
primaryKey: true
},
AccountName: {
type: 'string'
},
idOrganization: {
type: 'integer'
}
},
GetAccounts: function (page, cb) {
Accounts.query('SELECT Accounts.AccountName as AccountName,' +
' Organizations.Name as Organization FROM Accounts' +
' JOIN Organizations on Accounts.idOrganization = Organizations.idOrganizations',
function (err, results) {
if (err) cb(err)
else cb(null, results);
});
}
}
模块导出一个javascript对象,{connection:...,tableName:...,...}。 Sails使用此值来扩展Waterline模型对象。
完成相同操作的TypeScript代码是什么?我尝试了几种变化,但似乎没有得到它。救命!感谢。
答案 0 :(得分:0)
var objectToExport = {
connection: 'freshairMysqlServer', ... };
export = objectToExport;
并确保使用--module commonjs