Menu

Functions

Module 4: Functions

Introduction

Functions are where most bugs enter a program: a caller passes the wrong argument, forgets one, or misuses the return value. Typing functions well turns each one into a clear contract that the compiler enforces at every call site.

This module covers how to type parameters and return values, handle optional and variable arguments, describe functions as values for callbacks, and use overloads and this when a function has more than one way to be called.

What you will learn in this module

  • How to type parameters and return values, including async functions
  • How optional, default, and rest parameters work
  • How to describe function types and type callbacks
  • How to write overloads for functions with several call signatures
  • How to type this and avoid common this bugs

TypeScript Tutorial

J

Jebasta





Get in Touch For Details