Interfaces
An interface declares a structural contract — a set of fields a type must have to satisfy it. Any type with the right fields satisfies it automatically, with no explicit implements.
Declaring an interface
interface Drawable {
x: f64
y: f64
}
interface Sized extends Drawable {
width: f64
height: f64
}
Structural, not nominal
A type need not be declared as a parent or implement anything explicitly. If it happens to have all the interface's fields with compatible types, it satisfies the interface.
Interfaces have one common consumer: reference fields (&T), which accept any value that structurally satisfies the interface. See References.