/sample_project_ts

Primary LanguageTypeScriptMIT LicenseMIT

TypeScript Sample Project

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.

Table of Contents

  1. Introduction
  2. Explicit Types
  3. Primitive Types
  4. Arrays
  5. Functions
  6. Object Types
  7. Union Types
  8. Type Aliases
  9. Interfaces
  10. Type vs Interfaces
  11. Optional Properties
  12. Enums
  13. Tuples
  14. Destructuring

1. Introduction

The 01_Intro.ts file contains introductory code samples that cover basic concepts and syntax of TypeScript.


2. Explicit Types

In the 02_ExplicitTypes.ts file, you will find examples demonstrating the use of explicit types in TypeScript, including type annotations and type assertions.


3. Primitive Types

Explore the 03_PrimitiveTypes.ts file to understand TypeScript's primitive data types such as number, string, boolean, null, and undefined.


4. Arrays

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.


5. Functions

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.


6. Object Types

Explore the 06_ObjectTypes.ts file to learn about object types in TypeScript, including object declarations, object destructuring, and type assertions with objects.


7. Union Types

The 07_UnionTypes.ts file contains code samples demonstrating the usage of union types in TypeScript, allowing variables to have multiple types.


8. Type Aliases

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.


9. Interfaces

The 09_Interfaces.ts file contains code samples demonstrating the usage of interfaces in TypeScript, allowing you to define object shapes and enforce contracts.


10. Type vs Interfaces

Explore the 10_TypeVsInterfaces.ts file to understand the differences between type aliases and interfaces in TypeScript and when to use each.


11. Optional Properties

The 11_OptionalProperties.ts file contains code samples showcasing how to define optional properties in TypeScript interfaces.


12. Enums

In the 12_Enums.ts file, you'll find examples demonstrating the usage of enums in TypeScript to define a set of named constants.


13. Tuples

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.


14. Destructuring

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.


Contribution

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.


License

This project is licensed under the MIT License - see the LICENSE file for details.


Thank you for exploring the TypeScript Sample Project! Happy coding!