Object types
Goal: Declare object shapes with the type brace form.
SJS uses type Name { ... } for structural types. Conformance is checked structurally — no implements keyword.
Example
type Point {
x: number;
y: number;
}
type Named {
name: string;
}
type Place extends Named {
city: string;
}
function label(p: Place): string {
return p.name + " @ " + p.city
}Key takeaways
- Members end with semicolons.
extendscomposes object types.- Classes satisfy object types implicitly.
Next: Generics