Skip to content

enhancement(types): Add typed return union for executeSqlIntegration #95

@larryro

Description

@larryro

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

  1. This would require updating all callers to handle the discriminated union properly
  2. Need to ensure type synchronization as return shapes evolve
  3. May want to apply similar pattern to executeRestApiIntegration for consistency

Related

From PR #82 code review feedback.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions