Sequence NODE_174
Medium

Define a Function Type for Async API Call

TypeScript
Technical Specification

Define a type alias ApiCaller that represents a function returning a Promise of generic type T.

Input/Output Samples
Input:ApiCaller<User[]>
Output:() => Promise<User[]>
Optimal Logic Path
type ApiCaller<T> = () => Promise<T>;
Architectural Deep-Dive
Typing async functions clearly is important for consistent, safe API layers.