TypeScript Strict Mode and Why It Matters
📖 Scenario: You are building a small TypeScript program to manage a list of users and their ages. You want to make sure your code is safe and free from common mistakes by using TypeScript's strict mode.
🎯 Goal: Create a TypeScript program that defines a list of users with their names and ages, uses strict typing to avoid errors, and prints the users who are adults (age 18 or older).
📋 What You'll Learn
Create an array of user objects with exact properties:
name (string) and age (number)Create a constant
adultAge set to 18Use a
for loop with variables user to filter users who are adultsPrint the names of users who are adults using
console.log💡 Why This Matters
🌍 Real World
Strict mode helps catch mistakes early in programs that manage user data, making apps safer and more reliable.
💼 Career
Many companies require strict TypeScript settings to ensure code quality and reduce bugs in production.
Progress0 / 4 steps