TypeScript tutorialLesson 13Free preview
TS Functions
This lesson is part of TypeScript · All levels
Summary
The TypeScript function can be annotated for parameters or return values, so the calling error is caught early. The parameters support question marks for optional and rest parameters for dynamic number arguments. This annotation makes the function as well as the living documentation of how to use it.
Key points
- Annotation of parameters and types increases security
- Optional parameters using the question mark
- The rest parameter collects the argument into an array
Full lesson
Code examples and quizzes
Full lessons, code examples, and quizzes are available to subscribers. 5 questions.