Type Assertions & Type Casting | Typescript Tutorial for Beginners
Web Dev Roadmap for Beginners (Free!):
Learn Type Assertions & Type Casting in this Typescript tutorial for beginners. Learn more about type assertions and type casting and complete a Typescript student challenge in detailed TS tutorial.
🚀 Become a full-stack web dev with Zero To Mastery Courses:
- The Complete Web Developer:
- Master the Coding Interview:
- Junior to Senior Dev Roadmap:
🚩 Subscribe ➜
📬 Course Updates ➜
❓ Questions - Please post them to my Discord ➜
☕ Buy Me A Coffee ➜
👇 Follow Me On Social Media:
Github:
Twitter:
LinkedIn:
🔗 All Resources for this Typescript Course:
🔗 Playlist for this Typescript Course:
Type Assertions & Type Casting | Typescript Tutorial for Beginners
(00:00) Intro
(00:05) Welcome
(00:28) Type Assertions vs Type Casting
(01:18) What are Type Assertions?
(01:58) Starter Code
(03:44) Converting Types with Assertions
(04:53) Angle Bracket Syntax instead of “as“
(05:55) Narrowing Return Values with Assertions
(08:37) Caution: Assertions allow mistakes!
(10:07) Double Casting and the unknown type
(12:03) DOM Selection Types
(16:19) Non-Null Assertions
(17:43) Angle Brackets and the DOM
(18:14) Student Challenge
(21:27) Solution 1: Beginners
(24:13) Solution 2: Type Assertion
Corrections:
(13:50) Syntax error: (’img’) is what is needed if the element has an id set to “img“. This does not change the concept I’m discussing. Just tired eyes and a syntax error.
📚 Suggested Pre-requisites for this Typescript course:
🔗JavaScript for Beginners full course:
📚 Tutorial References:
🔗 Typescript Official Website:
🔗 Anders Hejlsberg, Creator of Typescript and C# Interview:
🔗 Stackoverflow Survey Results: #technology-most-popular-technologies
🔗 MDN - Static Typing:
🔗 MDN - Dynamic Typing:
🔗 MDN - Type Coercion:
🔗 TS Type Assertions: #type-assertions
⚙ Web Dev Tools:
🔗 Chrome Browser:
🔗 Visual Studio Code (VS Code):
🔗 & npm:
🔗 Live Server VS Code Extension:
Was this Typescript Assertions and Type Casting tutorial helpful? If so, please share. Let me know your thoughts in the comments.
#typescript #assertions #casting
1 view
15
3
2 months ago 00:29:18 1
Muslim Leader: If Americans Convert, “The Issue of Palestine is Solved“
2 months ago 00:03:39 1
2 Sons Of The East - Yelhomie ft. Moko Koza (Official Music Video)
2 months ago 00:11:10 1
Indian Diplomat Humiliates Trudeau - Khalistanis Work For Canadian Intel Agency! Kinjal Choudhary
3 months ago 00:08:22 5
THIS IS RARE - Nearby Shots Of UFO Orbs Which make Crop Circles #alien #uap
3 months ago 00:06:12 1
Top Secret Anti-Gravity Spy Aurora project - TR3b Black Manta - part 3
3 months ago 00:08:40 4
Daylight Mystery: Glowing Pyramid UFO Caught on Camera in Mexico City #uap #aliens #mysterious
4 months ago 01:31:10 1
Overcoming Trauma in Extraterrestrial Encounters and the Emerging New Humans - Guest: Mary Rodwell
4 months ago 00:04:46 1
An Appellate Court Will Not Change a Plea Contract