✔
Copied!
TypeScript IDE
TS
main.ts
×
Loading
⟳
Reset
⎘
Copy
Run
Output
Ln 1, Col 1
⌫
Clear
// myseby - TypeScript playground // Press Ctrl + Enter (or click Run) to compile & execute interface User { id: number; name: string; email?: string; } const users: User[] = [ { id: 1, name: "Ada" }, { id: 2, name: "Linus", email: "linus@example.com" }, ]; function greet(user: User): string { return user.email ? `Hello ${user.name} (${user.email})` : `Hello ${user.name}`; } users.forEach(u => console.log(greet(u)));
Output
Ln 1, Col 1
⌫
Clear
Initialising TypeScript
First-time setup — only takes a few seconds
↺ Retry