Install Node.js/npm, TypeScript, and a code editor
1. Welcome and Icebreaker:
- Welcome to our TypeScript journey! What’s one thing you’re excited to learn about TypeScript?
2. Outline the Session:
- Today, we’ll set up our development environment. This includes installing Node.js and npm, TypeScript, and Visual Studio Code (our recommended editor). By the end, you’ll have everything you need to start coding in TypeScript.
- Feel free to ask questions at any point!
3. Concept Explanation:
- Node.js and npm: Node.js is a JavaScript runtime that lets us run JavaScript code outside of a web browser. npm (Node Package Manager) comes with Node.js and is used to manage project dependencies, including TypeScript.
- TypeScript: TypeScript is a superset of JavaScript that adds static typing. We install it globally or per project using npm.
- Code Editor (VS Code): A good code editor enhances productivity. VS Code has excellent built-in support for TypeScript, including IntelliSense, debugging, and a terminal.
4. Live Coding Demonstration:
- Installing Node.js and npm:
- Visit https://nodejs.org/ and download the LTS version for your operating system.
- Run the installer.
- Verify installation by opening a terminal and typing:
node -v npm -v
- Installing TypeScript:
- In your terminal, install TypeScript globally:
npm install -g typescript - Verify installation:
tsc -v
- In your terminal, install TypeScript globally:
- Installing VS Code:
- Visit https://code.visualstudio.com/ and download the version for your OS.
- Run the installer.
- Open VS Code. You can open a terminal directly within VS Code (View > Terminal).
5. Tasks:
- Short Exercise:
- If you haven’t already, install Node.js, npm, TypeScript, and VS Code.
- Open VS Code and then open its integrated terminal.
- In the VS Code terminal, confirm that
node -v,npm -v, andtsc -vshow the installed versions. - Create a new folder for your TypeScript projects (e.g.,
my-typescript-projects).