CoffeeScript转换代码是错误的吗?

don*_*ald 3 mongodb node.js coffeescript

我正在使用Mongoose + CoffeeScript,当我尝试将嵌入文档添加到我的Schema时,代码被错误地转换.

例如:

AccountSchema = new Schema # Companhia
    name : String
    users  : [UserSchema]
    custphones  : [CustphoneSchema]
Run Code Online (Sandbox Code Playgroud)

AccountSchema = new Schema({
    name: String({
      users: [UserSchema],
      custphones: [CustphoneSchema]
    })
  });
Run Code Online (Sandbox Code Playgroud)

应该成为

AccountSchema = new Schema({
    name: String,
    users: [UserSchema],
    custphones: [CustphoneSchema]
 });
Run Code Online (Sandbox Code Playgroud)

为什么会这样?

谢谢

vha*_*lac 5

您是否检查了缩进与标签和空格的使用是否一致?当空格是语法的一部分时,这是一个常见问题.

为了得到你特定的(破碎的)输出,你可能缩进了tab name,并且空格userscustphones.