代码之家  ›  专栏  ›  技术社区  ›  NullVoxPopuli

为什么typescript要为装饰程序转换死代码?

  •  0
  • NullVoxPopuli  · 技术社区  · 7 年前

    在我的翻译代码中,我看到了:

    var __decorate = undefined && undefined.__decorate || function (decorators, target, key, desc) { // ...
    

    undefined && undefined.__decorate 应该永远是假的。 __decorate . 我的预感是 undefined 一些变量,并在构建时用一个值交换。

    我的问题是:为什么不删除永远的虚假表达?

    多亏了 @Matt McCutchen ,

    Typescript本身有一个 this 引用,提及 here .

    那么,也许巴贝尔在用这个做什么?

    0 回复  |  直到 7 年前
    推荐文章