Engrain by ByteRush

TS.03.01 JuniorCore — asked often

Typing functions

Comes up in: Coding

This concept is being written. It gets the full five steps — explanation, predict, interview angle, practice with tests, and review cards. Here is exactly what it will cover, so you can study it elsewhere in the meantime.

What it covers

  • parameter and return types
  • optional/default/rest params
  • function type expressions
  • call signatures
  • this parameters
  • overloads (and when a union is better)

Words you will know

function typeoverloadcall signature

What you will practise

  • type a debounce function

Interview questions this answers

  • Type a function getProperty(obj, key) so the return type matches the key.
  • When would you use function overloads instead of a union parameter?