Concept
A function type names the parameters and the return type, such as (a: number) => string. You need one whenever a function is passed around: callbacks, handlers and strategies.
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 Function types doing its job.
type Formatter = (value: number) => string;
const money: Formatter = (v) => "$" + v.toFixed(2);
const percent: Formatter = (v) => Math.round(v * 100) + "%";
function render(values: number[], format: Formatter): string[] {
return values.map(format);
}
render([0.5, 1.25], money);Typing a callback parameter as Function. It accepts anything callable and tells you nothing about arguments or return, so every call through it is unchecked.
Your roadmap puts these before Function types, unless you already know them.
Once a session shows you understand Function types, 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 Function types.