Skip to content

MJ-RWA/INTRO2TYPESCRIPT

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

38 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

git # INTRO2TYPESCRIPT GIDA SKILLUP SUMMER CLASS ACTIVITY

Welcome to your TypeScript class activity. In this exercise, you will practice converting JavaScript code to TypeScript

Instructions

Follow the steps below carefully.

1. Fork this Repository

Click on the “Fork” button to create your own copy of the repository.

2. Clone Your Fork

Open your terminal and clone your forked repository:

git clone <your-forked-repo-url>

3. Create Your Own Branch

Create and switch to a new branch using the following naming convention:

<yourname>-TS-class-activity

Example:

git checkout -b Faith-TS-class-activity

4. Install Dependencies

Run the following command to install all required packages:

npm install

5. Complete the Exercises

Open the file:

src/index.js

and convert all the JavaScript code to TypeScript.

You’ll be working through the following sections:

Strings – Add types for the name variables.

Numbers – Type variables and ensure totalPrice is a number.

Boolean – Add the boolean type and make it type-safe.

Union Type – Add a union type for a function parameter that accepts both string and number.

Arrays – Use proper array types for names and scores.

Intersection Type – Combine two types (User and Account) into one (Customer).

Tip: Save your TypeScript version in a new file named:

src/activity.ts

6. Run Your Code

After completing your TypeScript conversions, you can run or compile it using either of the following commands.

Run with ts-node:

npx ts-node src/activity.ts

Or compile to JavaScript:

npx tsc

7. Commit and Push Your Work

When you are done, commit your changes with the following message exactly as shown:

git add .

git commit -m "chore: My GIDA Skillup Typescript class Activity"

git push origin <yourname>-TS-class-activity

8. Submit

After pushing your changes:

Go to your GitHub repository.

Confirm that your branch and commit are visible.

Share your branch link with your instructor for review.

Checklist Before Submission

You created and worked on your own branch.

You converted all sections to TypeScript.

You installed dependencies and successfully ran your code.

You committed with the correct message.

You pushed your changes to your branch.

About

GIDA SKILLUP SUMMER CLASS ACTIVITY: CONVERT THIS JAVASCRIPT CODE TO TYPESCRIPT

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • TypeScript 93.6%
  • JavaScript 6.4%