Главная
Study mode:
on
1
Intro
2
Welcome
3
Type Assertions vs Type Casting
4
What are Type Assertions?
5
Starter Code
6
Converting Types with Assertions
7
Angle Bracket Syntax instead of "as"
8
Narrowing Return Values with Assertions
9
Caution: Assertions allow mistakes!
10
Double Casting and the unknown type
11
DOM Selection Types
12
Non-Null Assertions
13
Angle Brackets and the DOM
14
Student Challenge
15
Solution 1: Beginners
16
Solution 2: Type Assertion
17
13:50 Syntax error: document.getElementById'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.
Description:
Dive into a comprehensive tutorial on Type Assertions and Type Casting in TypeScript for beginners. Explore the differences between type assertions and type casting, learn how to convert types using assertions, and understand the angle bracket syntax. Discover techniques for narrowing return values, working with DOM selection types, and using non-null assertions. Complete a hands-on student challenge with two solution approaches. Gain valuable insights into TypeScript's type system and improve your coding skills through practical examples and explanations.

Type Assertions and Type Casting - Typescript Tutorial for Beginners

Dave Gray
Add to list