This is my first article and I'm trying to visualize my articles and called it Illustrated series.
I hope the attached photos are really better than 1000 words for you.
What is is keyword in Typescript? Let's see:
Imagine, you want to publish a lib that contains some utility functions like below:
We do not have any access to Date methods because the function returns a boolean and why we should access to Date methods?
Typescript performs User-Defined Type Guards and it would be better if we performed a type checked:
If the isDate function returns true, TypeScript will narrow the type to Date in if block and now, we have access to Date methods.
Have a good day/night with Typescript.
 
 
              


 
    
Top comments (0)