TypeScript

Type-safe JavaScript with TypeScript

187 tutorials
12 of 187 tutorials
Jul 17, 2026· 5 min read

Let and Const in TypeScript

TypeScript infers different types for let and const. Learn how block scoping changes type inference, why const gets literal types, and when to choose each.

TypeScript
Jul 17, 2026· 5 min read

Type Widening in TypeScript

Type widening is how TypeScript expands a narrow inferred type into a wider, more general one. Learn when widening happens, why let widens but const does not, and how to control it.

TypeScript
Jul 17, 2026· 6 min read

Type Narrowing Basics in TypeScript

Type narrowing is how TypeScript refines a wide union type to a more specific one based on runtime checks. Learn typeof, truthiness, equality, and in-operator narrowing.

TypeScript
Jul 17, 2026· 5 min read

Assignment Compatibility in TypeScript

TypeScript uses structural typing to decide if one type can be assigned to another. Learn the rules of assignment compatibility for objects, functions, and primitives.

TypeScript
Jul 17, 2026· 5 min read

When to Add Type Annotations in TypeScript

TypeScript can infer types in many places, but some spots always need annotations. Learn when inference is enough and when you must write types explicitly.

TypeScript
Jul 17, 2026· 5 min read

TypeScript Function Types Explained

A function type describes what arguments a function accepts and what it returns. Learn the arrow syntax for function types, how to use type aliases, and where function types appear in real code.

TypeScript
Jul 17, 2026· 5 min read

Type Function Parameters in TypeScript

Every function parameter in TypeScript needs a type annotation. Learn the syntax for typing parameters, why inference does not work here, and how to handle destructured parameters.

TypeScript
Jul 17, 2026· 5 min read

Optional Parameters in TypeScript

Mark a function parameter as optional with the ? syntax. Learn how optional parameters work, how they interact with undefined, and the key rule for callbacks.

TypeScript
Jul 17, 2026· 5 min read

Rest Parameters in TypeScript

A rest parameter collects any number of remaining arguments into a typed array. Learn the ... syntax, how to type rest parameters, and the difference between rest parameters and spread arguments.

TypeScript
Jul 17, 2026· 5 min read

Type Arrow Functions in TypeScript

Arrow functions in TypeScript can be typed just like regular functions. Learn the syntax for typing arrow function parameters, return types, and how contextual typing works differently.

TypeScript
Jul 17, 2026· 6 min read

Type Callback Functions in TypeScript

A callback is a function passed as an argument to another function. Learn how to type callback parameters and the key rule about optional callback parameters.

TypeScript
Jul 17, 2026· 6 min read

Create a tsconfig File

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.

TypeScript