Welcome to the TypeScript Learning Repository! This repository is designed to help you learn and practice TypeScript, a statically typed superset of JavaScript that compiles to plain JavaScript.
TypeScript is a powerful tool for writing robust and maintainable code. It offers features such as static type checking, classes, interfaces, and more. By using TypeScript, you can catch errors early in the development process and improve the overall quality of your code.
- Static Typing: TypeScript allows you to define types for variables, function parameters, and return values, helping you catch type-related errors at compile time.
- Type Inference: TypeScript can automatically infer types based on the assigned values, reducing the need for explicit type annotations.
- Interfaces and Classes: TypeScript supports object-oriented programming with interfaces and classes, making it easier to structure and organize your code.
- Compatibility: TypeScript is a superset of JavaScript, meaning any valid JavaScript code is also valid TypeScript code. It can be seamlessly integrated into existing JavaScript projects.
The repository is organized into several directories, each focusing on different aspects of TypeScript:
-
01_intro/: This directory contains introductory TypeScript files that cover the basics of TypeScript, including variables, basic types, and type inference.
-
02_basics/: This directory dives deeper into TypeScript basics, covering functions, objects, arrays, unions, tuples, enums, interfaces, abstract classes, generics, and type narrowing.
-
03_project_ts/: This directory contains a sample TypeScript project setup with configuration files.
-
hello.js: Compiled JavaScript file from
hello.ts. -
hello.ts: Example TypeScript file demonstrating basic TypeScript features.
-
README.md: This README file.
-
tsconfig.json: TypeScript configuration file for the repository.
To get started with this repository, follow these steps:
-
Clone the repository:
git clone <repository-url> cd <repository-directory>
-
Install dependencies:
npm install
-
Compile TypeScript files:
npx tsc
-
Run the TypeScript files:
node <compiled-js-file>
Contributions are welcome! If you have any suggestions or improvements, feel free to open an issue or submit a pull request.
This repository is licensed under the MIT License. See the LICENSE file for more information.
Happy coding!