← Back to list

Dive into TypeScript: Writing Your First Program

Welcome back to our TypeScript journey! In this blog post, we’ll dive right into the exciting world of TypeScript programming by writing…

Omayer Ahmad · 2024-05-05 08:28 · 0 claps · 0.9 min read
#typescript #javascript #beginner-coding #basic-typescript
Open on Medium ↗
Wiki topics: 💻 · Programming 🌐 · Web Development

Dive into TypeScript: Writing Your First Program

Welcome back to our TypeScript journey! In this blog post, we’ll dive right into the exciting world of TypeScript programming by writing your first TypeScript program. Get ready to experience the power and simplicity of TypeScript syntax!

Writing Your First TypeScript Program

Let’s start with a simple “Hello, World!” program. Create a new file with a .ts extension (e.g., hello.ts) and add the following code:

function greet(name: string): string {
    return "Hello, " + name + "!";
}

console.log(greet("World"));

Save the file and open your terminal. Navigate to the directory containing your TypeScript file and run the following command:

tsc hello.ts

This command will compile your TypeScript code into JavaScript. Once the compilation is successful, you’ll see a new file named hello.js in the same directory.

Now, let’s execute our program by running:

node hello.js

You should see the output:

Hello, World!

Congratulations! You’ve just written and executed your first TypeScript program.

What’s Next?

Now that you’ve got a taste of TypeScript, the possibilities are endless. In the next blog post, we’ll explore basic syntax and TypeScript features in more detail. Stay tuned for more TypeScript goodness!


메타데이터
post_id
f34dca677391
slug
dive-into-typescript-writing-your-first-program-f34dca677391
url
https://medium.com/@coderomayer/dive-into-typescript-writing-your-first-program-f34dca677391
canonical_url
https://medium.com/@coderomayer/dive-into-typescript-writing-your-first-program-f34dca677391
author_url
https://medium.com/@coderomayer
status
ok
fetched_at
2026-06-09 15:37:30