TypeScript is Literal Magic

TypeScript is Literal Magic

Fireship

3 года назад

882,646 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

Dixit Parmar
Dixit Parmar - 12.09.2023 09:53

Love love love it ❤

Ответить
AvenDonn
AvenDonn - 04.08.2023 10:43

Reinvented the class

Ответить
Commandcracker8
Commandcracker8 - 30.06.2023 18:09

That’s actually insanely cool

Ответить
Sagar Jain
Sagar Jain - 28.06.2023 11:10

How to get all these items in dropdown liat

Ответить
TheOPtimal
TheOPtimal - 21.06.2023 19:53

ClojureScript still wins

Ответить
Bowie
Bowie - 11.06.2023 01:04

Imagine if this existed in css, lot of libraries would see their last days

Ответить
TRIO
TRIO - 05.05.2023 22:21

Useless

Ответить
Mr Alex
Mr Alex - 09.04.2023 00:39

There was only one time I really applied this feature, love typescript

Ответить
mustafa yasser
mustafa yasser - 08.02.2023 21:54

Wooooo

Ответить
WREFMAN
WREFMAN - 08.02.2023 03:31

Why?

Ответить
Horrid
Horrid - 06.02.2023 02:26

👏👏👏👏

Ответить
Adrian Seidel
Adrian Seidel - 14.12.2022 19:47

I dont really like the way they implemented template types.
It's not possible to make a hex color type (`#${"a" | "b" | ... | "z" | "A" | ... | "Z" | 0 | ... | 9}`), because it would be to many possible combinations. They either could have just checked, if the input matches the template instead of generating and saving every possible combination and so limitating the range of possiblities, or, what would be even better, implemented regex based template types.

Something that I also miss in ts, are conditional Interface fields.
To always use
type T = {
a: true;
b: number;
} | {
a: false;
}
really sucks.
I would really like something like this.
interface I {
a: boolean;
b[a]: number;
}

Ответить
Cat The
Cat The - 25.10.2022 18:25

cool

Ответить
n01
n01 - 04.10.2022 10:48

Lol, I just did this like 2 days ago except manually

Ответить
All Is Cool
All Is Cool - 25.09.2022 09:50

SO MAGICAL 🤩

Ответить
Baka Vaca
Baka Vaca - 11.09.2022 07:35

Wow... Now that is a lovely type system! Gets me more interested in picking up Typescript for sure!

Ответить
Tip Fertilizer
Tip Fertilizer - 07.09.2022 18:20

You always make confused explaination

Ответить
Pixobit
Pixobit - 03.09.2022 04:49

I'm creating a card game with different colors and values. This literally saves my life. 7 Lines of code result in 105 unique cards.

Ответить
Hexadecimal Hexadecimal
Hexadecimal Hexadecimal - 17.06.2022 05:36

Literally magic.

Ответить
Omnik
Omnik - 17.06.2022 00:03

So... they have limited your ability to use whatever whenever, but then have added a way around it? I've will never understand why TypeScript exists.

Ответить
PriceyIndividual
PriceyIndividual - 11.06.2022 08:46

This might be the most glorious thing I’ve witnessed all week

Ответить
Sorvex
Sorvex - 08.06.2022 01:12

Jesus JavaScript Is such a mess

Ответить
GrimDaReaper
GrimDaReaper - 03.06.2022 17:58

I lost my last braincell trying to be a programmer now i dont know what 1 + 1 in math anymore

Ответить
gggiiia
gggiiia - 03.06.2022 12:24

JS the world

Ответить
Meleeman
Meleeman - 02.06.2022 21:44

Why not just use an array?

Ответить
你的帳戶再次違反《社群守則》
你的帳戶再次違反《社群守則》 - 02.06.2022 13:18

Really useful 🤠

Ответить
Nagulan Ngl
Nagulan Ngl - 02.06.2022 12:00

😳👍👍

Ответить
José Mário da Silva Júnior
José Mário da Silva Júnior - 02.06.2022 03:41

You did it, you implemented elm in ts

Ответить
Riflan Ahmed
Riflan Ahmed - 01.06.2022 17:53

How are you adding emoji?

Ответить
QV Citizen
QV Citizen - 30.05.2022 11:20

Meanwhile in JS u don’t even need to worry about types, but thanks.

Ответить
James Dials
James Dials - 28.05.2022 15:54

Those are like inline enums

Ответить
William Swiss
William Swiss - 28.05.2022 00:28

Instead of arrogantly bragging about Template Haskell, I'm going to try implementing a similar process to what was shown to determine ease or difficulty

Ответить
Dooby McFoosen
Dooby McFoosen - 28.05.2022 00:25

You can't have a language called "TypeScript" without it involving a little type theory.

Ответить
Trollerjak the Trolling God-Emperor of Trolls
Trollerjak the Trolling God-Emperor of Trolls - 26.05.2022 19:31

So this is C++ Enum with emojis?

Ответить
Badwizard
Badwizard - 26.05.2022 08:20

What the fuck is a type

Ответить
Dr. Ainz
Dr. Ainz - 26.05.2022 04:27

Nice, now I can make my code completely incomprehensible and ensure my continued employment. After all, no one they hire will be able to decipher the ultra-nested hell I use this feature to create in my codebase.

Ответить
Aleks L
Aleks L - 25.05.2022 01:03

I don’t understand this sorry

Ответить
Harrys Kavan
Harrys Kavan - 23.05.2022 14:00

Could you do a video about types and interfaces. And when to use what. The seem to partially be redundant.

Ответить
Sagit Swag
Sagit Swag - 23.05.2022 08:24

Wait till typescript devs learn what a struct is

Ответить
jd
jd - 23.05.2022 04:52

TypeScript is actually unnecessary trash bloat tho, change my mind ¯\_(ツ)_/¯

Ответить
Handsome_Hero
Handsome_Hero - 20.05.2022 01:26

Didn’t understand any of this, thanks

Ответить
PTM
PTM - 18.05.2022 17:53

How to derive an array of these 25 types. Or do I need to do it the hard way?

Ответить
Ali Faisal
Ali Faisal - 17.05.2022 20:21

Are these equivalent to c# enums?

Ответить
Артём Мухамед-Каримов
Артём Мухамед-Каримов - 17.05.2022 11:23

Wow, almost looks like an algebraic data type. I have never seen anything like that, yet I see that again

Ответить
metal lords rules
metal lords rules - 16.05.2022 14:52

That looks very cool

Ответить
killerwhiteshark
killerwhiteshark - 08.05.2022 20:37

How do I save this

Ответить
Rohan Manchanda
Rohan Manchanda - 29.04.2022 05:56

No

Ответить
Kuro Itsuki
Kuro Itsuki - 28.04.2022 06:47

I love ts

Ответить
Patricia Sauer - Authentic Programming
Patricia Sauer - Authentic Programming - 23.04.2022 22:42

Very interesting

Ответить