Explanation
TypeScript adds static types to JavaScript so you catch bugs earlier and write clearer APIs.
Code example
typescripttype User = {
id: string;
name: string;
email: string;
};
function greet(user: User): string {
return `Hello, ${user.name}`;
}
const learner: User = {
id: "1",
name: "Amina",
email: "amina@example.com",
};
console.log(greet(learner));Exercise
Convert a small JavaScript utility file to TypeScript with typed functions and interfaces.
