🕵️ SicherheitslückenHak5: Hackers Just Poisoned the Rust Supply Chain | Threat Wire(01.09.2026 um 14:00 Uhr)
🕵️ SicherheitslückenHak5: Hackers Found a Way Into Humanoid Robots | Threat Wire(04.09.2026 um 15:04 Uhr)
🔧 AI Nachrichten Bits und so #1021 (Passwort für Laufwerk)(31.08.2026 um 22:15 Uhr)
🔧 AI Nachrichten Bits und so #1022 (Wie Weißbier)(06.09.2026 um 20:39 Uhr)
🍏 iOS / Mac OSHue-App 6.0 ist da: das sind die Neuerungen(07.09.2026 um 17:21 Uhr)
🕵️ SicherheitslückenHak5: Hackers Just Poisoned the Rust Supply Chain | Threat Wire(01.09.2026 um 14:00 Uhr)
🕵️ SicherheitslückenHak5: Hackers Found a Way Into Humanoid Robots | Threat Wire(04.09.2026 um 15:04 Uhr)
🔧 AI Nachrichten Bits und so #1021 (Passwort für Laufwerk)(31.08.2026 um 22:15 Uhr)
🔧 AI Nachrichten Bits und so #1022 (Wie Weißbier)(06.09.2026 um 20:39 Uhr)
🍏 iOS / Mac OSHue-App 6.0 ist da: das sind die Neuerungen(07.09.2026 um 17:21 Uhr)

🔧 Programmierung 🕛 kürzlich 4 Min Lesezeit
0

Getting Started with TypeScript: Installation, Version Management, and Your First Program!

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht

TypeScript is a powerful language that builds on JavaScript by adding static typing, allowing developers to catch errors early in the development process. TypeScript brings us closer to a “safe code” experience, making it easier to manage large codebases and collaborate in teams.



In this blog, we’ll explore:




  1. What TypeScript is and why it matters

  2. Setting up TypeScript with fnm and managing Node.js versions

  3. Running TypeScript with ts-node and creating our first program



Let’s dive in!









1. What is TypeScript?



TypeScript is a superset of JavaScript that introduces static typing. It’s developed by Microsoft to help developers catch potential bugs earlier. Here’s why TypeScript is so popular:





  • Static Typing: Helps prevent common mistakes by checking types at compile time.


  • Readability: Makes code more understandable, which is crucial for large teams.


  • Tooling: TypeScript integrates well with IDEs like VSCode, providing autocompletion and better error checking.



In short, if you’re serious about writing reliable, scalable JavaScript, TypeScript is worth the investment.









2. Installing TypeScript and Managing Node.js Versions with fnm



To get started with TypeScript, we need to install Node.js and TypeScript itself. Here, we’ll use Fast Node Manager (fnm) for managing Node versions. This allows you to easily switch between different Node versions for different projects.






Step 1: Installing fnm





  1. Install fnm:
    Run the following command in PowerShell to install fnm:




CODE
   iwr -useb https://fnm.vercel.app/install | iex







This command downloads and installs fnm. After installation, restart your terminal to activate fnm.






  1. Verify fnm Installation:
    After restarting, check if fnm is working:




CODE
   fnm --version






You should see the version number, which means fnm is ready!






Step 2: Installing Node.js with fnm





  1. Choose a Node Version:
    With fnm, you can install a specific version of Node. Let’s install Node.js LTS (long-term support version):




CODE
   fnm install --lts








  1. Set Default Node Version:
    To make the installed version default, use:




CODE
   fnm use --lts








  1. Verify Node.js Installation:
    Check if Node.js and npm are properly installed:




CODE
   node -v
npm -v






Now, you’re all set to use Node.js with fnm.









3. Installing TypeScript and ts-node



With Node.js ready, let’s install TypeScript and ts-node (a package that allows us to run TypeScript files directly).





  1. Install TypeScript:
    Using npm, install TypeScript globally so that it’s accessible across projects:




CODE
   npm install -g typescript








  1. Install ts-node:
    Now, install ts-node globally:




CODE
   npm install -g ts-node








  1. Verify Installation:
    Check if TypeScript and ts-node are installed correctly:




CODE
   tsc -v
ts-node -v












4. Running Your First TypeScript Program



Now that our environment is set up, let’s create and run a basic TypeScript program.






Step 1: Create a TypeScript File




  1. Create a New File:

    In your preferred text editor, create a new file named hello.ts.


  2. Write a Simple Program:

    Add the following code to hello.ts:





CODE
   const greet = (name: string): string => {
return `Hello, ${name}! Welcome to TypeScript.`;
};

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






Explanation:





  • const greet is a function that takes a name parameter of type string.


  • : string after the parameter means that the function will return a string.


  • console.log outputs the result to the terminal.






Step 2: Run the TypeScript File



With ts-node, you can run this file directly without compiling it separately.




CODE
ts-node hello.ts






You should see this output in your terminal:




CODE
Hello, LinkedIn! Welcome to TypeScript.












Summary



Congratulations! You’ve successfully set up a TypeScript environment, managed Node.js versions with fnm, and run your first TypeScript program using ts-node. Here’s what we covered:




  • What TypeScript is and why it’s useful

  • How to install fnm and manage Node.js versions

  • Setting up TypeScript and ts-node for running TypeScript files

  • Writing and running a basic TypeScript program



With TypeScript in your toolkit, you’ll experience more reliable, readable code in your JavaScript projects. Stay tuned for more tutorials on advanced TypeScript features and happy coding!









Let’s Connect!



If you found this article helpful or have any questions, feel free to connect with me on LinkedIn. I’d love to hear your thoughts and help you along your TypeScript journey!

Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Hackers Just Poisoned the Rust Supply Chain | Threat Wire
1 Quelle
Hackers Found a Way Into Humanoid Robots | Threat Wire
1 Quelle
Bits und so #1021 (Passwort für Laufwerk)
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Getting Started with TypeScript: Installation, Version Management, and Your First Program!

Thematisch verwandte Begriffe: Getting, Started, with, TypeScript · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...