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.
Click on the “Fork” button to create your own copy of the repository.
Open your terminal and clone your forked repository:
git clone <your-forked-repo-url>
Create and switch to a new branch using the following naming convention:
<yourname>-TS-class-activity
Example:
git checkout -b Faith-TS-class-activity
Run the following command to install all required packages:
npm install
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
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
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
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.
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.