TypeScript from Zero: Setup and Your First Program
November 6, 2026
Welcome to TypeScript from Zero, a series for complete beginners: you do not need to know JavaScript or any other language. In this first episode we install the tools, write one line of code, run it, and see why TypeScript exists. Every code block below is the exact code and output from the video, ready to copy.
- All episodes are in the TypeScript from Zero playlist.
- Versions used: Node.js 26.13.0, npm 11.20.0, TypeScript 7.0.2.
1. What TypeScript is
TypeScript is JavaScript plus types. A type says what kind of value something is, like a number or a piece of text. Because of that, a tool can find mistakes before the program runs.
2. Check the tools
Node.js runs our programs outside the browser. npm comes with it and installs packages. Check both versions (Node 26 or newer):
node --version
npm --versionv26.13.0
11.20.03. Create the project
A folder, an empty file whose name ends in .ts (TypeScript), and VS Code:
mkdir hello-ts
cd hello-ts
touch hello.ts
code .4. The first program
console.log prints text to the terminal. Put this in hello.ts:
console.log("Hello, TypeScript!");5. Run it
Recent versions of Node run TypeScript files directly. Node just removes the types and runs the rest:
node hello.tsHello, TypeScript!6. A typo crashes at run time
Change the line to consol.log(...) (no e) and run it again:
consol.log("Hello, TypeScript!");ReferenceError: consol is not defined
at Object.<anonymous> (file:///home/mah/hello-ts/hello.ts:1:1)Node checks nothing before it starts, so the program crashes while it runs.
7. Install TypeScript
npm init -y creates a package.json for the project, and npm install adds TypeScript to it:
npm init -y
npm install --save-dev typescript8. tsc finds the mistake first
tsc is the TypeScript compiler. --noEmit means: only check, write no files.
npx tsc --noEmit hello.tshello.ts:1:1 - error TS2552: Cannot find name 'consol'. Did you mean 'console'?The code TS2552 names this kind of error. Node runs code, tsc checks code. We will use both in this series.
9. Fix and check again
Put console.log back. When tsc prints nothing there are no errors:
npx tsc --noEmit hello.ts
node hello.tsHello, TypeScript!Recap
- TypeScript is JavaScript plus types.
node file.tsruns a file,npx tsc --noEmit file.tschecks it.- Every error has a code, like
TS2552.
Next episode: Variables with let and const.