1.Optional Chaining (?.):
Optional chaining allows you to safely access nested properties or methods without worrying about null or undefined value...
For further actions, you may consider blocking this person and/or reporting abuse
Hey bro, great post!!
A small observation. For point 8 you can use the
PartialType like this:Even, add new properties, for example:
__
Another one I enjoy quiet often is the const assertion. With them you can make stuff readonly outside of class members. For example:
With as const:
Without as const:
Hey 👋 Nice post 😉
An improvement for point 3 :
Most of the time, when we create something with
unknownit's because you don't know how to provide. In your case, you specify a string value that could be confusing for some beginner developers.What do you think ? 🙂
You should avoid type assertion as much as possible. You're basically telling typescript to ignore itself and listen to you instead.
Instead of type assertion, use typeguards. You can even make a function to narrow down the type:
in the optional chaining
const invalidCode = user.address?.postalCode?.toLowerCase();console.log(invalidCode); // Output: undefined
not log undefined
Сongratulations 🥳! Your article hit the top posts for the week - dev.to/fruntend/top-10-posts-for-f...
Keep it up 👍
Nice list 👍 One thing I would add to the type guards example is the
isoperator: typescriptlang.org/docs/handbook/a...It's true no matter how experienced you are, you indeed need some good tools to make you shine. Thanks for writing such a great article.
A useful list, and very well presented -- even if the first two are native Javascript features, not specific to TS :)
Great post! I've never looked a lot into decorators until now, would've never thought they were so straightforward to implement
Hi bro, great post!
Congratulations. It’s a great post and I believe it will help a lot of beginners!
Great tips! Understanding advanced TypeScript concepts can really improve code quality and maintainability. In a similar way, having clear and organized information—like a Checkers Menu with Prices—helps users quickly find what they need and make informed decisions. Thanks for sharing these practical insights.
We’ll explore the world of organic whole spices, why they’re worth your investment, how to use them effectively, and how purchasing from 5Senses ensures that you are getting the best spices for your cooking.
I wonder if you can take these rules and lint your code with ChatGPT...
wow what an amazing post i love this you may also love this Apkrabi
amazing i love this you may also love this Playpkr game download