typeover
curriculum

Curriculum Idioms & ecosystem The small-interface idiom exercise 5 · fill-word

The small-interface idiom

Type the keyword that starts an interface declaration in Go (paired with the type name and interface { ... } body).

TypeScript reference
Fill the blanks →

About this theme

io.Reader { Read(p []byte) (n int, err error) }. One method. Go interfaces are typically tiny because implicit satisfaction rewards it — small interfaces are easy to satisfy accidentally, which is good. The community phrase: "accept interfaces, return structs." Funcs take the smallest interface they need.