Sequence NODE_170
MediumDefine a Generic API Result Type
TypeScript
Technical Specification
Create a generic ApiResult<T> type that has success, data, and optional error message.
Input/Output Samples
Input:ApiResult<User[]>
Output:Typed response for array of users
Optimal Logic Path
type ApiResult<T> = {
success: boolean;
data: T | null;
error?: string;
};Architectural Deep-Dive
Wrapping API responses in a generic type ensures consistent typing across different endpoints.