← All Exercises

TypeScript Basic Type Annotations

basictypescript~10min

Background

Type annotations are the foundation of TypeScript, enabling static type checking and better developer tooling.

Problem

Write a TypeScript function that takes a string name and a number age, returning a formatted greeting string with proper type annotations.

Input

A string name and a number age as function parameters.

Output

A formatted greeting string combining name and age.

Sample tests

Sample 1

Input: "Alice", 30
Expected: "Hello Alice, you are 30 years old."

Your solution

Learning objective

Learn basic TypeScript type annotations for function parameters and return types.