TypeScript · Types and shapes
Interface
Describes an object shape. Interfaces can be extended and declared twice; type aliases cannot.
Syntax
interface User { … }Example
Example
interface User {
id: string;
name: string;
}
const user: User = { id: "u1", name: "Ada" };More in this group
Learn this in the course
Reference pages are the quick answer. The course explains the why, shows the full example and ends with a challenge.