Show notes
Hey there friends Today is January 11th 2021, and I want to talk about
single variable names in TypeScript. Well think of variable names ingeneral, but for some reason in TypeScript when we're making like generictypes or type names whatever we've just I don't know where it came from.I guess people say it came from C sharp and stuff they do this, but using
the letter T to denote the type force like a generic or something. Prettyridiculous. I mean, there are some situations where it's obvious that likewhat what the types are.And there's no real better name necessarilyassuming that everybody understands the convention that T stands for type.But there are so many cases where you've got a couple of different types
that you're providing. Each one has a unique purpose and we could justcommunicate that purpose with a actual variable name but instead for somereason we're using single letter variables. I'm not sure where this camefrom but it does need to stop please stop doing this and just use adescriptive variable name.And now like this is more like in general, I just noticed.This a lot with
TypeScript definitions you know And it's fine if it's like you're inside ofyour own little function and you know like with a map or something we aremapping over some data and you use D or whatever.I don't really care about that. I'm just talking about when you're exposing
types to consumers. You wouldn't have like a single letter function thatyour consumers are calling or or like objects with single letters for D isduration, like nobody knows that. So given an actual variable name so thatpeople know what they're working with and what they need to pass.As those arguments and we're better I don't like I feel like we don't need
to have this conversation because it's kind of one of those things that wejust everybody knows a single letter variable names not a good thing. Typesare no different make your types longer variable names so that we know whatthose things are for.It's kind of a rant but I yeah just keep in mind that people if you're
going to expose something as like for other developers to use thedevelopers are going to use them and they may not know what you're talkingabout when you.Using single letter variables. So yeah, that's all that.I have to say about that. I hope you have a stellar week and we'll catch
you all around. Bye.
