TypeScript | Declaring a RANGE of Integers

Опубликовано: 22 Июнь 2026
на канале: Nick De Raj
7,832
17

In this quick video, I go over how we can declare a range of integers explicitly in TypeScript instead of just the generic 'number'. It uses a rather confusing looking recursive function but we break down step by step how it works and examples of where you could use this! If this helps, please drop a like and comment to let me know if you need me to cover anything else (or if you just wanna say hi!) ✌️

The code & more: https://nickderaj.com/youtube/typescr...

Chapters:
00:00 - Introduction
00:39 - The range helper type
01:18 - Example 1
01:58 - Example 2
02:30 - Inclusive of last value
03:07 - Breaking down the Enumerate Type
05:22 - Recursive - What is it?
06:03 - Comparing to a While Loop
07:48 - Recursive Function
8:27 - Outro