Which Typescript Features are Not Implemented in ES6? [closed]

ぃ、小莉子 提交于 2019-12-20 10:53:49

问题


Apart from the obvious type system, I have read that there are features in TypeScript that are not available in ES6. The article did not mention what these features were or why they should be avoided.

I am already aware that TypeScript implements ES7 async/await syntax and this post (Which ES6 Features are Implemented in Typescript) gives us the inverse relationship.


回答1:


New features that do not exist in ES 6

  1. Decorators
  2. Abstract classes
  3. Namespace (Module)
  4. Enums
  5. Generics and Static typing
  6. Interfaces
  7. Optional properties and arguments
  8. Function overloads
  9. Default parameters
  10. Access modifiers

As @A Red Herring says:

TypeScript is a superset of JavaScript, not the other way around, so it makes sense that many features in TypeScript will not be present in ES6

That is why don't forget about pure JS features, and thinking in JS, but not in TypeScript



来源:https://stackoverflow.com/questions/32889670/which-typescript-features-are-not-implemented-in-es6

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!