📘
TypeScript Playground
Write TypeScript with real-time compilation
▶ Run
Reset
TypeScript Code
TypeScript 5
Strict Mode
// TypeScript Playground interface User { name: string; age: number; email?: string; } function greetUser(user: User): string { return `Hello, ${user.name}! You are ${user.age} years old.`; } const user: User = { name: "Alice", age: 25, email: "alice@example.com" }; console.log(greetUser(user)); // Try changing the types and see what happens! // Example: Try passing a number instead of a string
💡 Tip: Use interfaces, types, and generics
🔍 Type checking happens automatically
Compiled JavaScript
Console Output
// Compiled JavaScript will appear here...