I finished your TypeScript course a couple of weeks ago, and I must say it is pretty solid, I enjoyed it quite a lot. I wish there was a Colt Steele’s course for every single thing I wanna learn :)
Colt just wanted to say thank you again. I recently enrolled in a part time university and I can't tell you enough how incredible your web dev on udemy is compared to what they teaching at this university. I'm basically just there for the qualification. If it wasn't for you my dream of being a dev would not be viable. Thank you
Just think of them as variables for types. You are telling your editor that this here is gonna be of my type named User. The editor can then assume that everything inside the code that references that variable that was of type is now User, and it knows it's an object that has certain properties, methods etc...
for anyone wondering we can have multiple generic types in the same function for example: sample(arr:T[], num:V, str:Y) also we can have generic interface properties
I used to watch your web development courses as a beginner and now I work full time employed with typescript. Thank you 🙏 Generics are the one thing I always struggle with. Would love to see more TS content.
as a fun challenge for generics try to type a reimplementation of the map and reduce methods Arrays have. Just had to do that today for my List class (based on the doubly linked list from your JS Algorithms course that I really need to go continue at some point) and it was really amazing when I got it to work the way I wanted it to where the type is automatically inferred based on the callback return types :)
Excellent, would love to see you cover a minimalistic set of basic TypeScript that offers the biggest ROI for the minimum investment in TypeScript. I think a full on implementation of TypeScript is overkill for the average JS developer but the basic concepts like typed variables and parameters to functions, enums and basic generics as you have shown here certainly offer a big ROI for just a small effort. Thanks Colt 😀👍
Thanks. I was just struggling to understand generics. I'm also not sure when I should use interfaces over types or vice versa. I recall reading somewhere that some use the former for behavior and the latter for data.
No, this is not the hardest part of TypeScript. This is the hardest part of TypeScript: interface Bogus) | Parameters & (Length extends 0 | 1) ? F : (arg_0: typeof E => R>: (type: T extends { 0: infer U } ? [U] : T extends { 0?: infer U } ? [U?] : never;
I don't think generics per se is what trips people up. What trips people up is Conditional Types. Those Type challenges and gymnastics that are entirely done in "Type land". Here is what I'm talking about 👇 👇 type ParseQueryString = S extends '' ? {} : Tokenize extends infer Q ? { [K in (Q & [string, unknown][])[number][0]]: Normalize } : never
I wish the course got more into this. I feel like anyone ready to learn TS could have picked up all that information very quickly from docs and trial/error. Or just any course that uses typescript could cover its topics "inline" without confusing much. TypeScripts type system is (allegedly) Turing complete. This allows for some pretty crazy-looking types like this. I wish he would have gone as in-depth with TS as he did for the Git bootcamp.
@@Thorax232 Thank you for this input. There are literally no course out there that goes deep into the actual Type System and it's super frustrating. I thought I was going to find that in this course.