TypeScript Project Setup for Beginners
Set up a complete TypeScript project from scratch. Create a tsconfig.json, organize source and output folders, add build scripts, and run your code with one command.
Type-safe JavaScript with TypeScript
Set up a complete TypeScript project from scratch. Create a tsconfig.json, organize source and output folders, add build scripts, and run your code with one command.
A type annotation tells TypeScript exactly what type a variable, parameter, or return value should be. Learn the syntax, where annotations go, and when to use them.
Type inference lets TypeScript figure out types automatically from the values you assign. Learn how inference works, where it shines, and when you still need annotations.
TypeScript's string, number, and boolean types map directly to JavaScript primitives. Learn how to use each one, what values they accept, and common mistakes to avoid.
Any and unknown both accept every type, but any disables type checking while unknown forces you to narrow the type first. Learn the critical difference and when to use each.
Void means a function returns nothing useful. Never means a function never returns at all. Learn the difference, when to use each, and how never enables exhaustiveness checking.
Null means no value, undefined means not assigned yet. Learn how TypeScript's strictNullChecks prevents the most common runtime error in JavaScript, and how to safely handle missing values.
An enum is a way to define a set of named constants in TypeScript. Learn numeric enums, string enums, const enums, and when to use enums versus union types.
New TypeScript developers make the same mistakes: skipping parameter types, overusing any, and forgetting that types disappear at runtime. Learn to spot and fix the most frequent errors.
Readonly values in TypeScript prevent accidental mutation. Learn readonly properties, ReadonlyArray, readonly tuples, the Readonly utility type, and how readonly differs from const.
A default parameter provides a fallback value when the caller omits an argument. Learn how TypeScript infers the type from the default and how defaults differ from optional parameters.
A tsconfig.json file tells TypeScript how to compile your project. Learn how to create one, what the key sections mean, and which options to set first.