У нас вы можете посмотреть бесплатно TypeScript Enums are TERRIBLE. Here's Why. или скачать в максимальном доступном качестве, видео которое было загружено на ютуб. Для загрузки выберите вариант из формы ниже:
Если кнопки скачивания не
загрузились
НАЖМИТЕ ЗДЕСЬ или обновите страницу
Если возникают проблемы со скачиванием видео, пожалуйста напишите в поддержку по адресу внизу
страницы.
Спасибо за использование сервиса ClipSaver.ru
TypeScript enums have worn their welcome. In the early days before string unions became so powerful, there was no other option. Today, though, they are more trouble than they're worth. This talk explores some of the problems with enums as well as some solutions to those problems. No solution is perfect, but perhaps no perfect solution uses TypeScript's enums, either. :P 00:00 how enums work in general 00:45 the value of enums by default 01:00 the first failure of enums 01:30 attempting to fix this problem with required indices 02:00 what do enums look like at runtime? 02:50 another downside: function arguments 03:43 working around the problem with function arguments 04:31 there are footguns (even with workarounds) 04:47 a better approach than enums: POJOs 06:14 audience question: why not just create a string union? 06:59 audience question: runtime values for a bad function argument? 07:56 audience comment: it's still just JavaScript 08:26 audience question: are there any keys on the enum? 09:22 audience comment: TypeScript runtime artifacts === bad 10:06 audience question: how do you deal with variations? 11:25 the satisfies operator could help 12:29 how to solve a new problem introduced by using objects Aaron Harper (https://github.com/goodoldneon) is a software engineer who enjoys gardening, biking, and spending too much time and money on an overkill homelab. Recorded on November 1st 2022 at Cahoots (https://cahoots.com) in Ann Arbor, Michigan.| Discord: / discord Twitter: / mitypescript Mastodon: https://fosstodon.org/@MichiganTypeSc... Instagram: / michigantypescript TikTok: / michigantypescript