DEV Community

Cover image for Advanced and Creative TypeScript Techniques for Professionals

Advanced and Creative TypeScript Techniques for Professionals

Shafayet Hossain on December 15, 2024

TypeScript has established itself as the go-to tool for building scalable, maintainable, and efficient applications. Its type system is not only ro...
Collapse
 
jayaramviswanathr profile image
Viswanath R

Great article

Collapse
 
shafayeat profile image
Shafayet Hossain

Thanks for the kind wordsπŸ–€

Collapse
 
amenibensaada profile image
Ameni Ben Saada

Thanks for sharing

Collapse
 
shafayeat profile image
Shafayet Hossain

No problem at all. Hope it adds value!😊😊

Collapse
 
urbanisierung profile image
Adam

Great series!

Collapse
 
shafayeat profile image
Shafayet Hossain

You're welcome! Glad you found it useful.πŸ˜ŠπŸ–€

Collapse
 
eshimischi profile image
eshimischi
Collapse
 
maklut profile image
makkentoshh {{β˜•}}

Amazing!

Collapse
 
shafayeat profile image
Shafayet Hossain

Thanks for checking it outπŸ˜ŠπŸ–€

Collapse
 
juan_labrada_42e0d23118f4 profile image
Juan Labrada

Nice article!! I have a question. I'm still figuring out the usefullness of Type Guards, which in principle seems fine, but in practice it seems awkward. The "typeof" operator have been out in the field in many languages and the examples I have seen both in your article and in the TypeScript documentation doesn't explain the need for that Type Guard.
For example: the isString function if the type guard ensures the value is string then why not just return true? At the same time it defeats the purpose to have a function that always returns true. And what would be the behaviour if I call the function with a number?
Just for the sake of understanding I created a test which worked the same with the type guard and without it, so, I can't spot the value of having such syntax.

Image description

Collapse
 
nozibul_islam_113b1d5334f profile image
Nozibul Islam

thanks for sharing a great article.

Collapse
 
shafayeat profile image
Shafayet Hossain

Thanks for taking the time to read it!πŸ–€

Collapse
 
serhiyandryeyev profile image
Serhiy

Great! Thanks!

Collapse
 
clark_allison_llp profile image
Clark Allison LLP

Good!

Collapse
 
minhazhalim profile image
Minhaz Halim (Zim)

Very creative and useful article. Thanks bro....