Marius Schulz short into into TypesScript weak type detection with code examples. A type is considered weak if all of its properties are optional. More specifically, a weak type defines one or more optional properties, no required properties, and no index signatures.
The main goal of weak type detection is to find likely errors in your code that would otherwise be silent bugs. Starting with TypeScript 2.4, it’s now an error to assign anything to a weak type when there’s no overlap in properties.
Another benefit is that the TypeScript language service can give us auto completion suggestions because the type annotation tells it what type of object we’re creating.
Author then describes:
- Workarounds for weak types
- The Limits of weak type detection