NodeJS 的 TypeScript ECMAScript 目标
TypeScript ECMAScript target for NodeJS
出于性能、兼容性和可扩展性的考虑,ECMAScript target 编译器 TypeScript 在带有 NodeJS 的模块中使用哪个最好?
根据 NodeJS ES6 (ECMAScript 2015) is not fully supported. Is it worth to use ES6 or is it better for the compatibility to add the target ES5 以及由 Typescript 自动生成的相关解决方法?
另一方面,目前这些是 进行中 ES6 的 NodeJS 函数:
--harmony-do-expressions (enable "harmony do-expressions" (in progress))
--harmony-class-fields (enable "harmony fields in class literals" (in progress))
--harmony-static-fields (enable "harmony static fields in class literals" (in progress))
--harmony-array-flatten (enable "harmony Array.prototype.flat{ten,Map}" (in progress))
--harmony-locale (enable "Intl.Locale" (in progress))
我不知道我现在是否需要这些功能,但为了代码的可维护性,这可能不是最佳选择。
Node.js fully supports ECMAScript 2015, with the exception of tail call optimization and ES modules(带有标志和 .mjs 扩展名的实验支持可用)。
在 Node 中使用 TypeScript 转换为 ES5 没有意义,TypeScript 不严格遵循规范并且也有其局限性,特别是 .
出于性能、兼容性和可扩展性的考虑,ECMAScript target 编译器 TypeScript 在带有 NodeJS 的模块中使用哪个最好?
根据 NodeJS ES6 (ECMAScript 2015) is not fully supported. Is it worth to use ES6 or is it better for the compatibility to add the target ES5 以及由 Typescript 自动生成的相关解决方法?
另一方面,目前这些是 进行中 ES6 的 NodeJS 函数:
--harmony-do-expressions (enable "harmony do-expressions" (in progress))
--harmony-class-fields (enable "harmony fields in class literals" (in progress))
--harmony-static-fields (enable "harmony static fields in class literals" (in progress))
--harmony-array-flatten (enable "harmony Array.prototype.flat{ten,Map}" (in progress))
--harmony-locale (enable "Intl.Locale" (in progress))
我不知道我现在是否需要这些功能,但为了代码的可维护性,这可能不是最佳选择。
Node.js fully supports ECMAScript 2015, with the exception of tail call optimization and ES modules(带有标志和 .mjs 扩展名的实验支持可用)。
在 Node 中使用 TypeScript 转换为 ES5 没有意义,TypeScript 不严格遵循规范并且也有其局限性,特别是