Design comparison
Solution retrospective
I just started learning TypeScript, what else should I improve and what are the best practices in developing a website using TypeScript? Thanks!
Community feedback
- @mattari97Posted over 2 years ago
Hello. Good job completing this challenge.
Little tips for typescript: instead of casting you selected elements to any; you should use the type HTMLElement. Sometime you can also use type Element or type Node.
This way you get typescript intellisense when pressing ctrl+spacebar in VScode.
When you select multiple nodes with querySelectorAll and you need to use array methods like foreach you can cast your elements to an array using Array.from(elements).foreach(node => do something)
Happy coding. Peace
Marked as helpful0@paulpdoaPosted over 2 years ago@AntoineC-dev wow this will be helpful! Thanks a lot man! Happy coding!
1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord