Features | Description | Example |
---|---|---|
Static Typing | TypeScript enforces static typing for variables and data. | let name to let name: string; |
Object-Oriented | Supports classes, interfaces, and inheritance. | |
Type Inference | Infers types based on values when type not explicitly provided. | |
Compiler Checks | Provides compile-time error checking. | |
ES6+ Features | Supports modern JavaScript features like arrow functions. | |
Tooling Integration | Excellent tooling for code editors and IDEs. | |
Enhanced Readability | Strongly typed code can improve code readability. | |
Code Refactoring Support | Helps in making code changes with confidence. | |
Compatibility with JavaScript | Can include JavaScript code and gradually adopt TypeScript. | |
Community and Libraries | A large community and rich ecosystem of libraries. | |
Interfaces | Define contract-like structures for classes and objects. | |
Class Properties | Define properties within classes with TypeScript types. | interface iCat { name: string; age?: number } Makes age option in interface. |
Public and Private Access | Control access to class members (public, private). Default public if not specified. | class Cat { private name : string; } only internal can access name . |