Concept
implements makes a class promise to match an interface, so the compiler checks every method and property is there with the right types. Code can then depend on the interface instead of the class.
The tutor works through these with you, in conversation and code. A session ends when you have shown them, not when a video does.
A few lines that show Implementing interfaces doing its job.
interface Storage {
get(key: string): string | null;
set(key: string, value: string): void;
}
class MemoryStorage implements Storage {
private data = new Map<string, string>();
get(key: string) { return this.data.get(key) ?? null; }
set(key: string, value: string) { this.data.set(key, value); }
}
function save(store: Storage) { store.set("theme", "dark"); }Typing variables and parameters as the class, like store: MemoryStorage, after going to the trouble of an interface. Swapping in another implementation or a test double then fails to type-check.
Your roadmap puts these before Implementing interfaces, unless you already know them.
Once a session shows you understand Implementing interfaces, it comes back for review. Each review takes a minute and tells the memory model how well you still know it.
Topics that build on Implementing interfaces.