As I see it there are two great reasons for Types, first by using types within your code, you are in a way ‘describing’ your code. For example, if you are creating a function that takes in two properties. Normally in JS you’d just past them in, all you’d know is their name, you don’t know ‘what’ they represent. Now with typescript, you can create object/types that describe what is being passed in. No more of this duck typing, where you are just throwing properties around not too sure what they actually are. So the first reason I think types are great is they give you this descriptive nature within your code. When you read TypeScript you know what the types of the properties being passed into a function are.
Originally published at CGCSoftware .