If you've got a specific question for @mattpocock, it's best to ask in his Discord. He doesn't get notified of comments here! www.mattpocock.com/discord
@yumcaxion9993
2 жыл бұрын
This was really useful for me! I've been using TypeScript in a medium-sized React app I'm working on and have wondered a number of times if more advanced knowledge (including a better understanding of generics) would help me make certain things more extensible. I think this helped put in perspective where some of these patterns might actually be useful and where it might be better to simplify my usage instead of trying to get overly clever. Seeing some of the syntax livecoded also helped cement a few things I might have seen once or twice but that just hadn't clicked for some reason.
@hugodsa89
2 жыл бұрын
Honestly a "Generic" is just a "Yet to be defined" type, that obtains its' definition at the moment of use. Its' definition is derived on the moment of consumption through the logic of its conditional assignment.
@nrrgrdn
Жыл бұрын
the definition of a Generic Type is derived on consumption by the logic of its argument
@koko0808008
2 жыл бұрын
Nice to have M. Pocock on the podcast. It's crazy to see this man had his 1st junior dev job 4years ago \o/
@knowa130
Жыл бұрын
Where does he say it?
@bigmistqke
2 жыл бұрын
The musician to dev pipeline. Interesting. I make music too and w me the coding process and music making process are often intertwined: coding while listening to a beat on an endless loop, from time to time taking a break from code and producing a little and back and forward. Is a lot of fun.
@scottamolinari
Жыл бұрын
Yup. That's me. I can get rid of the red squiggly lines. But, I'm far away from writing APIs in TypeScript myself. Had to comment on the "why this complicated deep TS stuff?" question.
@felipegutierrez2944
2 жыл бұрын
The stuffs you said about autocomplete and found errors before something happens is what made me change to TS
@dawid_dahl
8 ай бұрын
Loved this. Thank you! 🙏🏻
@linuseklund6984
2 жыл бұрын
i've been ssing around on a friends soft soft for years, finally bought it. I found your videos and instantly subscribed and have been
@BlurryBit
Жыл бұрын
26:54 my first aha moment of this video. :D I am sure I will find more. Great work!!
@dopetag
Жыл бұрын
1:17:01 the moment it clicked for Matt. "I think we found a bug in TypeScript" 😅
@0xAndy
2 жыл бұрын
Jason, thanks for hosting this. I've used generics a few times but this video is what I needed to feel more polished. errific!
@dev_s0mple
Жыл бұрын
Here's the quickest dirty solution :3 In the original problem just make the function argument instead of Key: TItem = 'a' Make it Key = 'a' as TItem Now everything works with correct types but if u call Ur function with no args getObjkey() (it's return type is a union of all possible values of Ur object:3) Which u can fix by getObjKey()
@thearcticmonkey
2 жыл бұрын
I love the people influencing the dev community!
@egm5081
Жыл бұрын
Actually there is a simpler solution for the last exercise: const getObjKey = (key: Tkey = "a" as Tkey) => { return obj[key]; }; notice the "as Tkey" part
@karpo1180
Жыл бұрын
Awesome TypeScript lessons with code examples, thank you for sharing mr. Jason You Rock 🤘
@learnwithjason
Жыл бұрын
thanks for watching!
@diego0ji
2 жыл бұрын
It clicks also for me! Amazing, thanks guys 🤩💙
@ROVAKAN
Жыл бұрын
i personaly do art for art , do software to earn my keep. and i'm here to learn some stuff
@scottamolinari
Жыл бұрын
At 1:06:00. Couldn't a type be declared to be string, like... type TRoute = string; ...in order to get rid of the "TRoute extends string" everywhere?
@scottamolinari
Жыл бұрын
Damn. I went to follow this in the code and the code in the repo now is totally different. That sucks.
@dopetag
Жыл бұрын
@@scottamolinari same here
@masudosman6543
Жыл бұрын
in makeConfigObj genric , how its getting inferred from only route's value???, when we are calling makeconfigObj({ routes:["/","/about","/contact"], fetchers:{ '/': ()=> 'string', '/about':()=> 21 } } ) but in " const makeConfigObj = (config: configObj) => config " this line " TRs extends to string" okay that's good but how TRs know it will only infer the routes keys { routes:["/","/about","/contact"],} from passing parameter , please any body explain, its happening in ts but i am confused how does it know???
@learnwithjason
Жыл бұрын
for specific questions, it's probably best to ask in Matt's Discord because he doesn't get notified about comments here: www.mattpocock.com/discord
@olehsolomka8268
Жыл бұрын
I have a question, does those overloads order matter?)
@learnwithjason
Жыл бұрын
I'm not sure - I'd recommend asking Matt in his Discord: www.mattpocock.com/discord
@bigmistqke
2 жыл бұрын
Oof that last exercise was painful.
@wiranatanegara4880
2 жыл бұрын
Any tips? I’m a newbie learning
@alvarobyrne
2 жыл бұрын
shouldn't solution no. 3 by @Learn With Jason be included in the repo, some PR or what not? Note to self: Typescript can infer FROM the refer type or it can infer THE return type : that is so neat.
@LucasAlda75
2 жыл бұрын
I dont recommend it bc if you do something with the Set before return it (seeding it with some elements for example) the Set inside the function will be Set, Jason's approach only works bc he returns it empty
@xtinctspecies
2 жыл бұрын
Top grade content
@devops-sushi5534
2 жыл бұрын
It actually wasnt a typescript bug i guess it was caused by the faulty function definitiion and the interpreter broke until the next valid code state
@avneet12284
2 жыл бұрын
This was great
@parison813619
2 жыл бұрын
I am getting invite invalid for discord
@circlemarketing2059
2 жыл бұрын
Out of interest, what sort of soft are you hoping to produce?
@Saitama-ur3lq
11 ай бұрын
Not gonna lie, second half went over my head, need a better tutorial for typescript generics
@learnwithjason
11 ай бұрын
check out Matt’s Total TypeScript stuff. toooons of additional material and examples there
@william3588
2 жыл бұрын
great
@dawid_dahl
8 ай бұрын
”Nr 2 is a banger.” RadScript.
@SahraClayton
2 жыл бұрын
I am only just getting into the Javascript world, Typescript really puts me off
@BobbyBundlez
Жыл бұрын
it get's easy fairly quick. it gets SO annoying with gastby, styled components and props and event listeners... but you get used to it fairly quick. i'm still such a beginner though
@arcan762
Жыл бұрын
TLDR?
@arunkaiser
2 жыл бұрын
First Comment
@robertguluna9180
2 жыл бұрын
i lost 50% of my braincells trying to figure out how to use tNice tutorials
Пікірлер: 46