es6 和 es2017 之间 'lib' 属性 in tsconfig.json 的区别?

Difference in the 'lib' property in tsconfig.json between es6 and es2017?

我一直在研究 lib 属性 的可能值在 tsconfig.json 文件中的 compilerOptions 中的含义。我在 Typescript GitHub 页面上找到了与这些值相对应的相关 d.ts 文件,显然通过使用 ES2017 包含以下 ES 功能:

/// <reference path="lib.es2016.d.ts" />
/// <reference path="lib.es2017.object.d.ts" />
/// <reference path="lib.es2017.sharedmemory.d.ts" />
/// <reference path="lib.es2017.string.d.ts" />
/// <reference path="lib.es2015.d.ts" />
/// <reference path="lib.es2016.array.include.d.ts" />
/// <reference path="lib.es2015.core.d.ts" />
/// <reference path="lib.es2015.collection.d.ts" />
/// <reference path="lib.es2015.generator.d.ts" />
/// <reference path="lib.es2015.iterable.d.ts" />
/// <reference path="lib.es2015.promise.d.ts" />
/// <reference path="lib.es2015.proxy.d.ts" />
/// <reference path="lib.es2015.reflect.d.ts" />
/// <reference path="lib.es2015.symbol.d.ts" />
/// <reference path="lib.es2015.symbol.wellknown.d.ts" />
/// <reference path="lib.es5.d.ts" />

但显然 ES6 不包括在内,并且有它自己的 file 没有引用任何东西。我的问题是,如果有人知道,可以安全地假设通过使用 es2017 我涵盖了所有 es6 功能(从打字的角度来看)还是应该单独包含在 lib 中选项?

例如,像这样:

{
  ...
  "compilerOptions": {
    ...
    "lib": ["es2017", "dom"]
  },
  ...
  }
}

或者这个:

{
  ...
  "compilerOptions": {
    ...
    "lib": ["es2017", "es6", "dom"]
  },
  ...
  }
}

通过 Typescript GitHub 上的 lib 文件夹进行一些挖掘和比较后,我发现,在 lib 属性 中使用 es6 compilerOptions 对应于在这些参考文献中找到的代码:

/// <reference path="lib.es2015.core.d.ts" />
/// <reference path="lib.es2015.collection.d.ts" />
/// <reference path="lib.es2015.generator.d.ts" />
/// <reference path="lib.es2015.iterable.d.ts" />
/// <reference path="lib.es2015.promise.d.ts" />
/// <reference path="lib.es2015.proxy.d.ts" />
/// <reference path="lib.es2015.reflect.d.ts" />
/// <reference path="lib.es2015.symbol.d.ts" />
/// <reference path="lib.es2015.symbol.wellknown.d.ts" />
/// <reference path="lib.es5.d.ts" />
/// <reference path="lib.dom.d.ts" />
/// <reference path="lib.scripthost.d.ts.d.ts" />
/// <reference path="lib.dom.iterable.d.ts" />

所以要回答我的问题,要用 es2017 正确覆盖 es6 的所有内容,tsconfig.json 的那部分应该如下所示:

{
  ...
  "compilerOptions": {
    ...
    "lib": ["es2017", "dom", "dom.iterable", "scripthost"]
  },
  ...
  }
}