TypeScript

Type-safe JavaScript with TypeScript

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

Typed Arrays in TypeScript

A typed array ensures every element in an array has the same type. Learn the two syntaxes for array types, how they prevent mixed-element bugs, and when to use each form.

TypeScript
Jul 17, 2026· 5 min read

Optional Tuple Elements in TypeScript

Optional tuple elements let you define tuples where some positions can be omitted. Learn the ? syntax, how optional affects length, and why optional elements must come last.

TypeScript
Jul 17, 2026· 5 min read

Map and Set Types in TypeScript

Map and Set are typed collections that track keys and unique values. Learn how to type Map<K, V> and Set<T>, how they differ from objects and arrays, and common mistakes.

TypeScript
Jul 17, 2026· 6 min read

Type Array Map Filter and Reduce

TypeScript gives map, filter, and reduce precise return types based on the callback. Learn how each method's type flows from input to output, and how to avoid common type mistakes.

TypeScript
Jul 17, 2026· 6 min read

Preserve Types When Transforming Arrays

Array transformations can lose type information if not written carefully. Learn how to preserve types through map, filter, and reduce using type guards, as const, and generics.

TypeScript
Jul 17, 2026· 6 min read

Choose Between Array Tuple Record Map and Set

TypeScript gives you several typed collection types. Learn how to choose between Array, Tuple, Record, Map, and Set based on your data's shape, key type, and access patterns.

TypeScript
Jul 17, 2026· 6 min read

Generic Functions in TypeScript

A generic function captures the type of its arguments and uses that type for parameters, return values, and internal logic. Learn how to write reusable functions that preserve type information.

TypeScript
Jul 17, 2026· 6 min read

Generic Interfaces in TypeScript

A generic interface defines a reusable shape where member types are filled in later. Learn how to declare generic interfaces and choose between interface-level and member-level type parameters.

TypeScript
Jul 17, 2026· 6 min read

Generic Constraints in TypeScript

Generic constraints limit which types a type parameter can accept. Learn how to use the extends keyword to require specific properties while keeping your functions generic.

TypeScript
Jul 17, 2026· 5 min read

Default Generic Type Parameters

Default type parameters let callers omit type arguments when a sensible fallback exists. Learn how to set defaults for generic functions, interfaces, and classes.

TypeScript
Jul 17, 2026· 6 min read

Keyof Operator in TypeScript

The keyof operator extracts the keys of an object type as a union of string literals. Learn how to use it for type-safe property access, generic constraints, and mapped types.

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