【发布时间】:2018-09-11 22:55:18
【问题描述】:
TypeScript 编译器有 following options 用于 --lib cmd 行 arg:
- ES2018
- ES2018.Promise
- ES2018.RegExp
它们之间有什么区别?如果我只需要 Promisefinally() 支持而不关心其他 ES2018 功能,我应该使用 ES2018 还是 ES2018.Promise?
另外,那些ES2018 库支持的TS 版本是什么?当我尝试将它们与 TS 2.6.2 一起使用时,它会抛出:
错误:tsconfig.json(16,13):错误 TS6046:“--lib”选项的参数 必须是:“es5”、“es6”、“es2015”、“es7”、“es2016”、“es2017”、“esnext”、 'dom','dom.iterable','webworker','scripthost','es2015.core', 'es2015.collection','es2015.generator','es2015.iterable', 'es2015.promise'、'es2015.proxy'、'es2015.reflect'、'es2015.symbol'、 'es2015.symbol.wellknown'、'es2016.array.include'、'es2017.object'、 'es2017.sharedmemory', 'es2017.string', 'es2017.intl', 'esnext.asynciterable'。
【问题讨论】:
-
正确。 ES2018 包括 AFAIK 对象 rest、Promise.finally 和正则表达式:命名捕获组、lookbehinds、s-flag 和 unicode 脚本属性。
标签: javascript typescript