higher-order function
A function that takes a function as an argument or returns one, such as map, filter or a wrapper that adds retries.
In more detail
Contextual typing gives the callbacks passed to higher-order functions their parameter types. Parameters<F> and ReturnType<F> let a wrapper return a function with exactly the same signature as the one it wraps.
Related terms
- Server Action security — Treating every Server Action as a public HTTP endpoint that anyone can call with any arguments.
- middleware — Code that sits between an incoming request and the handler that answers it, doing a shared job such as logging, authentication or rate limiting.
- callback — A function you pass to other code so it can call you back later, for example when an event happens or a timer fires.
- contextual typing — Type inference that flows from where a value is used, such as giving a callback's parameters the types the calling function expects.
- wrapper function — A function that calls another function, adding behaviour before or after it, such as timing, retries or logging.
Taught in
- Server Action Security: Zod Validation & Auth Gates — Next.js 15 & Modern App Router Architecture
- Type Annotations, Type Inference And Contextual Typing — Production TypeScript
- Function Utilities: ReturnType, Parameters And Constructor — Production TypeScript