发表文章

[Javascript] 向后兼容性问题 "Problems with backward compatibility"[adonis-framework]

enniel 6月前 19

中间件在版本4.0.29 和4.0.28 不按预期工作。在 "版本 < = 4.0.28 方法句柄中的中间件返回扩展参数:

classExample {
  asynchandlenextfirstsecondthird...args) {
     console.log(typeof// string
     console.log(typeof// string
     console.log(typeof// string
  }
}

在版本4.0.29 和4.0.30 返回数组中:

classExample {
  asynchandlenextfirstsecondthird) {
     console.log(typeof// array
     console.log(typeof// undefined
     console.log(typeof// undefined
  }
}
原文:

Middlewares in versions 4.0.29 and 4.0.28 do not work as expected. In version <= 4.0.28 method handle in middleware return spread args:

class Example {
  async handle ({ auth }, next, first, second, third, ...args) {
     console.log(typeof first) // string
     console.log(typeof second) // string
     console.log(typeof third) // string
  }
}

In versions 4.0.29 and 4.0.30 return array:

class Example {
  async handle ({ auth }, next, first, second, third) {
     console.log(typeof first) // array
     console.log(typeof second) // undefined
     console.log(typeof third) // undefined
  }
}
相关推荐
最新评论 (2)
thetutlage 6月前
1

是的, 这是罪魁祸首 d1fb5d1#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R51

我总是想在扩展操作符上加上一个数组。如果您正在维护一个包, 我建议您总是期待一个数组, 因为我建议大家使用最新版本, 除非它是一个主要版本。

原文:

Yup this is the culprit d1fb5d1#diff-b9cfc7f2cdf78a7f4b91a753d10865a2R51

I would always want to go with an array over the spread operator. If you are maintaining a package, I suggest expecting an array always, since I recommend everyone to use the latest version, unless it's a major release.

thetutlage 6月前
2

关闭, 因为没有从问题记者的反应, 也不可行

原文:

Closing since no response from the issue reporter and not actionable as well

返回
发表文章
enniel
文章数
1
评论数
0
注册排名
93204