No BS TS #11 - Enums and Literal Types in Typescript

preview_player
Показать описание
Lets export enumerations and literal types in Typescript and show how they can make your code safer.

00:00 Introduction
01:23 Enumerations
03:19 Literal types
04:55 Numeric literals
06:02 String literals
07:11 Outroduction

👉 What's my theme? Night Wolf [dark blue]
👉 What's that font? MonoLisa

💢 Watch our other videos:

Thank you for watching this video, click the "SUBSCRIBE" button to stay connected with this channel.

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

Dude these videos... I've been developing professionally for 7 years and this is one of the easiest to digest channels I've ever come across.

achillesnakmuay
Автор

Today I learned I've been pronouncing enums wrong all this time! Great videos!

johnnyutah
Автор

I never comment on youtube (or anywhere really) but I felt like I just had to let you know, these videos are the single most valuable thing I have found in order to learn ts. THANK YOU SO MUCH

adamlerman
Автор

Wow, string literals with function overloads - so cool! Didn't even know what function overload was before this video. Thank you for all the quality content, keep it up!

flibben
Автор

Amazing videos... I needed a TS refresher course after being out of TS for 8 months and this has been perfect. Thank you.

chrisvetrano
Автор

never learned so fast in that short time. Thank you so much.
I really like your speed and detail level; in conjunction with good hints and background, where to use it, and what to avoid. (: fun-fact, it's a loaded dice; please use "rand() * 6 + 1" if you ever want to have a 6 as result)

meyourstubes
Автор

Thanks for this series, I am learning a lot.

JulioDx
Автор

Sincerely thank you for all these quality videos buddy!

oykfwrl
Автор

Enumerations are one of my favorite ways to keep code clean!

zykoz
Автор

Absolutely top content... the best TS course you can find on youtube

TheRFracer
Автор

Literally the best `${...content}` around. No BS

zykoz
Автор

Absolutely loving your content Jack. Thanks so much :)
Can you please also suggest any course for Object-Oriented Programming/Designing using Typescript in greater depth, I have upcoming assignments on those lines.

pratikmakune
Автор

Great content so far! I also started with enums but I prefer the union type whenever possible.. unless there's a hard reason for an enum.

falias
Автор

Great video as always Jack. Have a question. When you constrain the values to rollDice function, what happens if the callee pass it argument which is a variable and it is not in the constrained value range of 1 | 2 | 3 | 4?

francis_n
Автор

Another very informative material. Thank you, Jack. A quick question: the englishLoadingState object you defined at 2:50, was it intended to explain enums? or use of enums? Could you please clarify what was it you wanted to demonstrate?

jimshtepa
Автор

I have a question. Why would I use an enum when I can create a type with unions instead? It has the same functionality but doesn't require the dot syntax. Also easier when looking at values for example, coming from a JSON file I found. Love the videos. I love typescript and I had no idea howm many features it had until I saw your series

kncle
Автор

what if we want to implement the last concept and example with concept of arraow function?what would be the code snippet for this? the example at 6:00

raminkhodaie
Автор

Good video, I just want to say; I prefer always use literal types instead of enums, because use literal types is more readable for me.

yokevinmendez
Автор

These videos are terrific.Here's something I've never quite understood though: What is the advantage of using an enum (particularly if you assign strings as the property values like you've sensibly done here) over just using a regular js object and referencing properties from that object. Do you have any insight to this, Jack?

enum LoadingState {
beforeLoad = "beforeLoad"
loading = "loading",
loaded = "loaded",
}

const loadingState = {
beforeLoad: "beforeLoad"
loading: "loading",
loaded: "loaded",
}

justinmooney
Автор

My string literal code give all two option although I write the same code

hadeedtmgggg