01 / 03
Type the data from a server
Front-end code receives JSON from a server and puts it on screen. The JSON is an object like { id: 1, title: "Shopping", done: false }.
Declaring the shape first is how things are done in the real world. Misspell a property and you know immediately.
interface TodoItem { id: number; title: string; done: boolean;}const item: TodoItem = { id: 1, title: "Shopping", done: false };console.log(item.title);Result
Shopping