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.
i think
: obj is ImportantType
is 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