First Program & Build/Run (tsc + node / tsx)
Write a simple TS program, compile with tsc, and run with node or tsx.
Intro
Goal: Write a small program, compile with tsc, and run the result with node or tsx.
Hello World
A minimal program: define a typed function and log a message.
// hello.ts
function hello(name: string): string {
return `Hello, ${name}!`;
}
console.log(hello("TypeScript"));All lessons in this course
- What is TypeScript? Benefits & use cases
- Install Node & TypeScript (npm i -D typescript), tsc --init
- First Program & Build/Run (tsc + node / tsx)