Congratulations! Really good article, very useful! I would like to add the possibility to create your own type guards on the type guard section, here is an example:
I'm current a student in frontend dev. I love learning new things, especially in the realm of web development. Also, becoming well acquainted with Rust's borrow checker.
That defeats the purpose of using the type guard altogether. Typescript wonβt infer the type from that function. :obj is ImportantType is the what tells typescript what the passed parameters type is. Hence type guard.
Congratulations! Really good article, very useful! I would like to add the possibility to create your own type guards on the type guard section, here is an example:
i think
: obj is ImportantTypeis ok, but can be more simpler:But it wouldn't be a type guard though.
thanks for explain
That defeats the purpose of using the type guard altogether. Typescript wonβt infer the type from that function. :obj is ImportantType is the what tells typescript what the passed parameters type is. Hence type guard.
thanks for explain
Great! A really good example, I will add it to the article.