TypeScript Tutorial menu

TypeScript Quiz

Check what you have learned in this TypeScript tutorial. Answer each question, then read the explanation.

How to Use This Quiz

  • There are 8 questions covering every lesson
  • Choose one answer for each question
  • If you get one wrong, go back to that lesson and try its examples again

Questions

Exercise

1. What does the TypeScript compiler tsc produce from a .ts file?

Exercise

2. What type does TypeScript infer for: let total = 250;

Exercise

3. Which type describes exactly two items, a string followed by a number?

Exercise

4. What does the ? mean in function greet(name?: string)?

Exercise

5. Which keyword lets one interface reuse and add to another interface?

Exercise

6. Inside if (typeof value === "string") { }, what is the type of value when it was declared as string | number?

Exercise

7. A class property marked protected can be used where?

Exercise

8. Which utility type makes every property of User optional?

What Next?

Well done for finishing the TypeScript tutorial. Use it in your next JavaScript project, and try it with a framework like React or Next.js.

Want to build full stack projects with a teacher? Join the Workownix Full Stack Web Development course, online or at our institute in Orangi Town, Karachi.

Learn TypeScript with a teacher

Join the Full Stack Development course at Workownix, online or in Orangi Town, Karachi, and get a certificate.

See the course Ask on WhatsApp