Summary
Add a typed return union for executeSqlIntegration() function to improve downstream type safety.
Context
Currently the function returns Promise<unknown> which is safer than any but doesn't provide compile-time type information for callers.
Proposed Solution
Define a typed union for the return type:
type ExecuteSqlResult = ApprovalRequiredResult | {
name: string;
operation: string;
engine: string;
data: unknown;
rowCount: number;
duration: number;
};
export async function executeSqlIntegration(
...
): Promise<ExecuteSqlResult> {
Considerations
- This would require updating all callers to handle the discriminated union properly
- Need to ensure type synchronization as return shapes evolve
- May want to apply similar pattern to
executeRestApiIntegration for consistency
Related
From PR #82 code review feedback.
Summary
Add a typed return union for
executeSqlIntegration()function to improve downstream type safety.Context
Currently the function returns
Promise<unknown>which is safer thananybut doesn't provide compile-time type information for callers.Proposed Solution
Define a typed union for the return type:
Considerations
executeRestApiIntegrationfor consistencyRelated
From PR #82 code review feedback.