Types have some cool features:
- Performance optimization
- Reduce developer cognitive load
- Enable some really great developer tooling features, such as auto-suggestion
The most often touted feature of types is highly overrated. I thing they’re crap at finding bugs compared to using a proper TDD and pull request process, but they do catch a few bugs, too, and that’s worth a mention.
Instead of simply examining the name of a type, or it’s “class”, structural types look at the actual structure of the object they’re comparing: the shape of the thing, not the name. That fact gives us a strong, formal type checking feature that is basically a standard way to ducktype your objects and interfaces.