- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
TypeScript: unknown vs any....Stop Turning Off the Type Checker #typescript #code
If you’re using any everywhere in TypeScript, you’re basically turning the type checker off.
any tells TypeScript to stop helping. You can access properties, call methods, and assign values freely....even when the shape is wrong. That means errors that should have been caught while coding can slip through and crash at runtime instead.
In this Short, I break down the difference between any and unknown and why unknown is the safer default when you genuinely don’t know the type yet.
The key idea is simple:
any disables type safety
unknown preserves type safety until you narrow the value
narrowing forces you to validate before using the data
That makes unknown much better for things like:
API responses
JSON.parse() results
catch block errors
user input
third-party data
And if you want an even cleaner approach, schema validation libraries like Zod can turn unknown input into fully typed data safely.
If you want the benefits of TypeScript, don’t silence it with any unless you absolutely have to.
Topics covered: TypeScript, unknown vs any, TypeScript type safety, runtime errors, narrowing, type guards, Zod, safer TypeScript, clean code, web development, TypeScript tips, TypeScript beginner concepts.
#typescript #webdevelopment #programming #javascript #cleancode #coding #webdev #softwaredevelopment
Видео TypeScript: unknown vs any....Stop Turning Off the Type Checker #typescript #code канала Syntax Junkie
any tells TypeScript to stop helping. You can access properties, call methods, and assign values freely....even when the shape is wrong. That means errors that should have been caught while coding can slip through and crash at runtime instead.
In this Short, I break down the difference between any and unknown and why unknown is the safer default when you genuinely don’t know the type yet.
The key idea is simple:
any disables type safety
unknown preserves type safety until you narrow the value
narrowing forces you to validate before using the data
That makes unknown much better for things like:
API responses
JSON.parse() results
catch block errors
user input
third-party data
And if you want an even cleaner approach, schema validation libraries like Zod can turn unknown input into fully typed data safely.
If you want the benefits of TypeScript, don’t silence it with any unless you absolutely have to.
Topics covered: TypeScript, unknown vs any, TypeScript type safety, runtime errors, narrowing, type guards, Zod, safer TypeScript, clean code, web development, TypeScript tips, TypeScript beginner concepts.
#typescript #webdevelopment #programming #javascript #cleancode #coding #webdev #softwaredevelopment
Видео TypeScript: unknown vs any....Stop Turning Off the Type Checker #typescript #code канала Syntax Junkie
Комментарии отсутствуют
Информация о видео
13 марта 2026 г. 21:28:12
00:00:31
Другие видео канала





















