In TypeScript, what is the main similarity between
interface and type alias when describing the shape of an object?- aOnly
interfacecan describe an object's shape;typeis for primitives only - bBoth can describe an object's shape with named properties and types✓
- cOnly
typecan describe an object's shape;interfaceis for classes only - dNeither can describe object shapes; both are limited to function signatures
Explanation:Both
interface and type alias can describe an object's shape (named properties with types) — this is their core overlapping use case. They differ in other capabilities (declaration merging, unions, etc.), covered in later questions, but describing object shape is something both do.