One of TypeScript’s core principles is that type-checking focuses on the shape that values have. This is sometimes called “duck typing” or “structural typing”.
The point variable is never declared to be a Point type. However, TypeScript compares the shape of point to the shape of Point in the type-check. They have the same shape, so the code passe
The shape-matching only requires a subset of the object’s fields to match.
There is no difference between how classes and objects conform to shapes If the object or class has all the required properties, TypeScript will say they match, regardless of the implementation details.