问题
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
- Decorators
- Abstract classes
- Namespace (Module)
- Enums
- Generics and Static typing
- Interfaces
- Optional properties and arguments
- Function overloads
- Default parameters
- 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