Welcome to the TypeScript Sample Project! This repository contains code samples covering various topics in TypeScript to help you learn and understand the language better.
- Introduction
- Explicit Types
- Primitive Types
- Arrays
- Functions
- Object Types
- Union Types
- Type Aliases
- Interfaces
- Type vs Interfaces
- Optional Properties
- Enums
- Tuples
- Destructuring
The 01_Intro.ts
file contains introductory code samples that cover basic concepts and syntax of TypeScript.
In the 02_ExplicitTypes.ts
file, you will find examples demonstrating the use of explicit types in TypeScript, including type annotations and type assertions.
Explore the 03_PrimitiveTypes.ts
file to understand TypeScript's primitive data types such as number, string, boolean, null, and undefined.
The 04_Arrays.ts
file contains code snippets showcasing how to work with arrays in TypeScript, including array declarations, accessing elements, and iterating over arrays.
In the 05_Function.ts
file, you'll find examples illustrating various aspects of functions in TypeScript, including function declarations, optional parameters, default parameters, and function overloading.
Explore the 06_ObjectTypes.ts
file to learn about object types in TypeScript, including object declarations, object destructuring, and type assertions with objects.
The 07_UnionTypes.ts
file contains code samples demonstrating the usage of union types in TypeScript, allowing variables to have multiple types.
In the 08_TypeAlias.ts
file, you'll find examples showcasing type aliases in TypeScript, enabling you to create custom names for types, making your code more readable and maintainable.
The 09_Interfaces.ts
file contains code samples demonstrating the usage of interfaces in TypeScript, allowing you to define object shapes and enforce contracts.
Explore the 10_TypeVsInterfaces.ts
file to understand the differences between type aliases and interfaces in TypeScript and when to use each.
The 11_OptionalProperties.ts
file contains code samples showcasing how to define optional properties in TypeScript interfaces.
In the 12_Enums.ts
file, you'll find examples demonstrating the usage of enums in TypeScript to define a set of named constants.
Explore the 13_Tuples.ts
file to learn about tuples in TypeScript, which allow you to express an array where the type of a fixed number of elements is known.
The 14_Destructuring.ts
file contains code samples demonstrating the usage of destructuring in TypeScript, allowing you to unpack values from arrays or properties from objects into distinct variables.
Contributions to this project are welcome! If you have any improvements, corrections, or additional code samples to share, feel free to open a pull request or create an issue.
This project is licensed under the MIT License - see the LICENSE file for details.
Thank you for exploring the TypeScript Sample Project! Happy coding!