Home
Categories
EXPLORE
True Crime
Comedy
Business
Society & Culture
Sports
Technology
History
About Us
Contact Us
Copyright
© 2024 PodJoint
00:00 / 00:00
Sign in

or

Don't have an account?
Sign up
Forgot password
https://is1-ssl.mzstatic.com/image/thumb/Podcasts125/v4/f3/de/0e/f3de0ec1-a1ff-ad7e-1d42-2ee41cae7253/mza_7142444209140500111.png/600x600bb.jpg
3 Minutes with Kent
Kent C. Dodds
235 episodes
8 months ago
👋 Hi there! I'm Kent C. Dodds (https://twitter.com/kentcdodds). This is a (week)daily podcast where I give 3 minute thoughts about web development. You can subscribe on iTunes here: http://kcd.im/3-mins-itunes and on RSS here: http://kcd.im/3-mins-rss
Show more...
Technology
RSS
All content for 3 Minutes with Kent is the property of Kent C. Dodds and is served directly from their servers with no modification, redirects, or rehosting. The podcast is not affiliated with or endorsed by Podjoint in any way.
👋 Hi there! I'm Kent C. Dodds (https://twitter.com/kentcdodds). This is a (week)daily podcast where I give 3 minute thoughts about web development. You can subscribe on iTunes here: http://kcd.im/3-mins-itunes and on RSS here: http://kcd.im/3-mins-rss
Show more...
Technology
https://briefs-production.s3.amazonaws.com/cover_art/34/Drawing__1_.png
TypeScript: Why I prefer `Array<Type>` over `Type[]`
3 Minutes with Kent
2 minutes 45 seconds
4 years ago
TypeScript: Why I prefer `Array<Type>` over `Type[]`
Good morning or afternoon or whatever it is for you friends, it's morning for me. I wanted to talk about how I type a raise in TypeScript, so there are two ways that I'm aware of that you can type an array and of course I guess there are a couple ways depending on what type of an array you want to make but just like a regular array you can either specify the type and then immediately thereafter with no space a open and closing bracket like the the syntax for an array and the alternative is there is a built-in. Array type which is a generic and you say array and then open bracket no that what are these angle brackets that's what is called an open angle bracket and then the type of that's in the array and then a closing angle bracket and I prefer the latter. I like using the generic array and the reason that I prefer that I I think that I just like just kind of preferred to that from the beginning, but I think the reason that I prefer using the generic array is because I don't,Like reading my type and then getting to the end and be like, oh this is an array of those things so I I see we've got um user and then I see the opening closing bracket and I say oh no, actually it's not a user it's an array of users, whereas if I use the generic I can see oh we've got an array and the things that are in the array are users and so I'm when I'm reading from left to right it just seems to make more sense to me to to read it in that way, it's kind of like in English it. I I like how in Spanish and you have the,If you have like an exclamation you're going to have that upset upside down exclamation point I don't know what that's called but you have that upside down exclamation point at the beginning of the sentence so you know ahead of time that the thing you're about to read is an exclamation rather than getting to the end of the sentence and being oh yeah, I'm supposed to be like excited about in saying this or something like that when I'm reading a book my kid or something and so I kind of see that in the same way and that's why I prefer using the generic over the the special syntax for specifying arrays, it is a little bit more type. Of being or more characters but I actually don't care too much about that and then that comes with the benefit of switching from a regular array to a read-only array, you know being a bit easier and stuff like that so anyway. I just thought that would be something I'd share today. I hope you're having a wonderful day and I'll chat with you soon.
3 Minutes with Kent
👋 Hi there! I'm Kent C. Dodds (https://twitter.com/kentcdodds). This is a (week)daily podcast where I give 3 minute thoughts about web development. You can subscribe on iTunes here: http://kcd.im/3-mins-itunes and on RSS here: http://kcd.im/3-mins-rss