This is one of the smarter aspects of using TS, good explanation. Some small side note, at 4:40 in real life we probably should use (unless it's on purpose) Object.hasOwn() instead of in, because the latter also finds the properties through the prototype chain.
In last example, while changing from fruit instanceof to isTasty in, last keyword "Banana" should be changed to parameter "fruit", to check isTasty exisits or not in fruit which is passed into that function
In the 4th example, wouldn't the comparison always return false if the two args's content are even slightly different? I think the type is what matters the less at that point since we're comparing it by content
This is one of the smarter aspects of using TS, good explanation. Some small side note, at 4:40 in real life we probably should use (unless it's on purpose) Object.hasOwn() instead of in, because the latter also finds the properties through the prototype chain.
Great point!
The best explanation so far 👍
In last example, while changing from fruit instanceof to isTasty in, last keyword "Banana" should be changed to parameter "fruit", to check isTasty exisits or not in fruit which is passed into that function
Really helpful, thanks a ton!
Glad it helped!
In the 4th example, wouldn't the comparison always return false if the two args's content are even slightly different?
I think the type is what matters the less at that point since we're comparing it by content
thank you