Guided Notes
Functions & Types
Typing parameters and return values, optional, default and rest parameters, function type aliases, callbacks, and overloads.
Parameters and return types
Slide 1 / 4function vat(net: number, rate: number = 0.18): number { return net * rate; }
• Parameters need types (TypeScript can't infer them in a declaration). • Return types can be inferred, but annotating exported functions documents intent and catches accidental changes. • Calling with the wrong number or type of arguments is an error.
