Turns out you can define types conditionally based on the a type check against a different type. Let’s try it out on a fetch function that optionally takes a callback and can return either a void or a promise based on that callback. 00:00 Introduction 00:17 Utility Types in the handbook 01:30 Function setup 02:58 Parameters and ReturnType 06:39 Class setup 07:30 ConstructorParameters and InstanceType 11:10 Outroduction Utility Types page: #parameterstype Code: If you liked this video, buy me a coffee! 👉 What’s my theme? Night Wolf [dark blue] 👉 What’s that font? MonoLisa 👉 Jack is also on the React Round Up podcast ... #JackHerrington #typescript #typescript_tutorial #no_bs_ts #no_bs_ts_19 #no_bs_ts_utility_types_2 #utility_types_in_typescript #no_BS_TS #typescript_utility_types_page #typescript_utility_type_omit 20210520 mOA1SA9sfcw
Hide player controls
Hide resume playing