Typescript Objects, Arrays, Tuples & Enums | Basics Tutorial

preview_player
Показать описание

In this Typescript Objects, Arrays, Tuples & Enums basics tutorial you will learn about each of those types as well as inferred & explicit types, optional properties, type vs interface, object params and more.

🚀 Become a full-stack web dev with Zero To Mastery Courses:

👇 Follow Me On Social Media:

Typescript Objects, Arrays, Tuples & Enums | Basics Tutorial

(00:00) Intro
(00:05) Welcome
(00:16) Getting Started
(01:13) Array Type Inference
(03:15) Array Assignment
(08:05) Array Any Type & Explicit Types
(08:27) Tuples
(12:05) Object Type
(13:59) Object Type Inference
(15:06) Object Type Annotation
(17:56) Object Assignment
(19:46) Optional Object Properties
(20:56) Object Type as a Parameter
(22:29) type vs interface
(23:51) Narrowing with Optional Properties
(26:43) Enums

📚 Suggested Pre-requisites for this Typescript course:

📚 Tutorial References:

⚙ Web Dev Tools:

Was this Typescript Objects, Arrays, Tuples and Enums basics tutorial helpful? If so, please share. Let me know your thoughts in the comments.

#typescript #objects #arrays
Рекомендации по теме
Комментарии
Автор

2:50 if we want to specify the type and we don't enclose the union type within parentheses like this
using:
string | number[]
instead of
(string | number)[]

TS will then think it's either a string or array of numbers,


In addition to using interfaces to declare custom types, the real power of interfaces (IMHO) comes from implementing it in multiple different classes,
after that we can use that interface to declare a param type in a function which now can accept any object implementing specified interface regardless of what its base class looks like

a rare but useful use case for enum is when combined with binary values to represent multiple options,
here is a quick example for a collection of weapons might be used in game dev

enum Weapon {
Pistol = 1,
Gun = 2,
Bomb = 4,
Sowrd = 8
}

// Collect a few weapons using bitwise OR
let myWeapons = Weapon.Gun | Weapon.Pistol

console.log(myWeapons)

// Check if you have a specific weapon using bitwise AND
if(myWeapons & Weapon.Bomb){
console.log('Drop your bomb')
}

if(myWeapons & Weapon.Gun){
console.log('Shoot the target')
}

Finally, thanks Dave and thanks to everyone who read so far,

ahmad-murery
Автор

This video is great for someone who wants to start in Typescript. Thanks

BirushaNdegeya
Автор

Just popped in quickly (since I am still doing your Javascript course) to give a thumbs up as I will be returning to watch this very excellent course. Man, I just love your teaching style. No BS, nice n' snappy and to the point!

Duelweb
Автор

This is an amazing tutorial! Thank you so much for this! I'm learning react and ts and this is super helpful. I'm understanding everything. Gonna watch the entire playlist if I have time

blueblue
Автор

Amazing Dave, really loved it,

I was looking for a series like this to learn ReactJs, I've seen crash course in ur channel but I need step by step tutorial like this . Thanks again and have a nice day

gabcompany
Автор

I learned many valuable things from your channel, thanks for sharing it

madi
Автор

You are the best teacher in coding ever. Thank you always

keunbai
Автор

Great one Dave! Thanks for sharing this 🤗

pHProgramming
Автор

Very clear explanations that even I as a beginner could understand.😃

Hferko
Автор

Brilliant tutorial, I enjoy a lot your teaching style. It was very interesting, thank you very much. I'm sure your channel is going to grow fast

damianodamian
Автор

Thanks Mr Gray.
I will remember to keep striving for progress over perfection because a little progress everyday will go a long way.

zuhaibamjad
Автор

Absolutely, one of the best channels about programming!

dansmar_
Автор

Would request you to start using Typescript in next React Project:)

piyushmahapatra
Автор

Thanks again Dave!, You are the BEST!

MOJICA
Автор

hello dave thank you for great tutorial. i learned many things from you such as redux toolkit full course and react authenthication, i just want to say thank you and i appreciate that.
and i dont want watch other TS courses because i feel more comfortable with your courses and your learnings way, So i wait untill you release the new episode

mohammadrezaakhshabi
Автор

Everyday, I’m grateful I started with JAVA

celestinenwachukwu
Автор

Thank you sir for your wonderful tutorial. Thanks from Bangladesh.

zabiremu
Автор

Your channel is the great treasure for the passionate learners

mdsalahuddin
Автор

man, telling me to "please give this video a like" really helpful since I always forget to leave a like before hopping to the next video

flowerofash
Автор

Thanks for sharing your incredible knowledge.

johannedwardpolaniagonzale
visit shbcf.ru