Engrain by ByteRush

TS.03.02 JuniorCore — asked often

Generics: the basics

Comes up in: Coding, Recruiter screen

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

  • type parameters
  • inference from arguments
  • constraints with extends
  • default type parameters
  • generic interfaces and classes
  • keyof constraints (getProperty<T, K extends keyof T>)

Words you will know

generictype parameterconstrainttype argument

What you will practise

  • first<T>, pluck<T,K>, typed groupBy

Interview questions this answers

  • What are generics and why use them?
  • Type a generic debounce.