4
我一直在研究在tsconfig.json
文件中找到的compilerOptions
中lib
属性的可能值是什么意思。我的Typescript GitHub页面上找到对应于那些值相关的d.ts
文件,显然使用ES2017
以下ES功能包括:es6和es2017之间tsconfig.json中'lib'属性的区别?
/// <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"]
},
...
}
}
OR这样的:
{
...
"compilerOptions": {
...
"lib": ["es2017", "es6", "dom"]
},
...
}
}
'ES6 == ES2015' – Bergi
@Bergi这不是真的根据打字稿的类型。它包括所有ES2015的东西和其他东西。看到我的答案吼叫。 – Vigidis