Discussion

Sign in or Join to comment or subscribe

2019-07-13T18:58:47Z ago

Hi, I personally would use Types in all projects and don’t really understand why you wouldn’t want to use them in smaller projects. Maybe because I’m mostly programming with Java, but also in JavaScript every line I write I have to be aware of the types. I’m thinking them if they are not written. I have to know what types the parameters are that come into a function, because that changes what I can do with them. If I expect a number to be given I can do different things with them as if a string or array is given. Surely you also have that types in mind, if you are writing the code. So why not simply also writing them down? If you read the function later the day you can directly see what you can give to it. And also the IDE can support you and prevents you from giving the object instead of it’s id or things like that. So it’s not an overhead because you think the types anyway, it’s better to read and understand (and code is usually read more often than written) and the tools support you. Why should you not use them in any single project?

The only problem is, that projects don’t have to use types as part of JavaScript, so not every project, package or frameworks has some. But that’s not really an argument against using types, it’s an argument to use more types and to get rid of projects that don’t use them.

Player art
  0:00 / 0:00