Matt Pocock 🏖️ (@mattpocockukarrow-up-right) - April 1, 2022 at 7:10 PM
🔥 TypeScript Tip #15 🔥
You can use generics to dynamically specify the number, and type, of arguments to functions.
Here, we create a sendEvent function which only asks for a payload if it's present on the event you're sending. pic.twitter.com/vvhYrBX0nRarrow-up-right
https://user-images.githubusercontent.com/870029/206737480-2ee2dfe6-b892-446a-8635-aceb814efaa1.mp4
Download mp4arrow-up-right
Tweet linkarrow-up-right
Thread by @mattpocockuk on Threadify Reader Apparrow-up-right
Last updated 2 years ago