HarshScindia / ts-basics-lab

TypeScript Basics

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

root

TypeScript - Basics

Introduction

This is your lab for today! 😉

We have learned some super useful things about TypeScript in class. Please keep reading and work on the following iterations.

Requirements

  • Fork this repo
  • Clone this repo

Submission

  • Upon completion, run the following commands
$ git add .
$ git commit -m "done"
$ git push origin master

Instructions

Exercise 0 - Test

Will be explained in class

Exercise 1 - Basic Types

There are 6 small exercises within this. Hover over the red squigglies and fix each error that you see.

To run this part of the exercise, open your terminal and type

ts-node index.ts

By doing that it's running the uncommented lines in index.ts

import exercise1 from  './src/Exercise_1_Basic_Types/exercise1';
exercise1();

You will see a lot of errors in your terminal. Your task is to fix those errors by looking at the exercise1.ts file in Exercise_1_Basic_Types folder.

In case you're stuck for too long, uncomment these two lines in index.ts and comment out the two lines from above to see the solution.

// ======== Solution 1: Basic types ========
import solution1 from  './src/Exercise_1_Basic_Types/solution1';
solution1();

and run ts-node index.ts again to see the required output.

Repeat the same process for all the exercises

Exercise 2 - Functions

Exercise 3 - Classes

Exercise 4 - Interfaces

Exercise 5 - Code Flow

Happy Coding! ❤️

About

TypeScript Basics


Languages

Language:TypeScript 100.0%