Optional chaining and nullish coalescing in TypeScript 3.7

preview_player
Показать описание
Curious about all the TypeScript 3.7 hype? Check out this video to learn more about optional chaining and nullish coalescing in TypeScript 3.7.

0:00 Introduction
1:10 Understanding the discount function
2:25 Defining your discounts

LogRocket is a frontend logging tool that lets you replay problems as if they happened in your own browser. Instead of guessing why errors happen, or asking users for screenshots and log dumps, LogRocket lets you replay the session to quickly understand what went wrong. It works perfectly with any app, regardless of framework, and has plugins to log additional context from Redux, Vuex, and @ngrx/store.

In addition to logging Redux actions and state, LogRocket records console logs, JavaScript errors, stacktraces, network requests/responses with headers + bodies, browser metadata, and custom logs. It also instruments the DOM to record the HTML and CSS on the page, recreating pixel-perfect videos of even the most complex single-page apps.

Рекомендации по теме
Комментарии
Автор

This is brilliant! Thanks for sharing. :)

timbauer
Автор

Thank you for the explanation! Quick question: Wouldn't you also need to put a question mark behind "country" @ 5:00 since it is an optional property of address? Unfortunately, your test cases don't seem to cover that.

MartinLgb