[英]Exporting module value
I am confused. 我很困惑。 I have the following javascript file:
我有以下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);
});
}
}
The module exports a javascript object, {connection: ..., tableName: ..., ...}. 该模块导出一个javascript对象{connection:...,tableName:...,...}。 This value is used by Sails to extend a Waterline model object.
Sails使用此值扩展水线模型对象。
What is the TypeScript code that accomplishes the same? 实现相同功能的TypeScript代码是什么? I have tried several variations but don't seem to be getting it.
我尝试了几种变体,但似乎没有得到。 Help!
救命! Thanks.
谢谢。
var objectToExport = {
connection: 'freshairMysqlServer', ... };
export = objectToExport;
and be sure to compile with --module commonjs
并确保使用
--module commonjs
进行编译
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.