Skip to content

Use AbortSignalLike from @azure/abort-controller instead of DOM AbortSignal #34

Description

@daviburg

Context

The inline PR review comment for AbortSignal support (added in the current review) uses the DOM AbortSignal type. Azure SDK TypeScript guidelines specify AbortSignalLike from @azure/abort-controller for broader compatibility.

Issue

// Current inline comment suggestion (DOM type — narrower)
abortSignal?: AbortSignal

// Azure SDK guideline (interface — broader, works with polyfills)
import { AbortSignalLike } from "@azure/abort-controller";
abortSignal?: AbortSignalLike

AbortSignalLike is a subset interface: { readonly aborted: boolean; addEventListener(...): void; removeEventListener(...): void }. Using it instead of the concrete DOM AbortSignal type:

  • Works in environments where the DOM AbortSignal type is not available
  • Allows passing custom abort signal implementations
  • Aligns with how @azure/core-rest-pipeline and all other Azure SDK packages accept cancellation

Proposed change

  1. Add @azure/abort-controller as a dependency (or use @azure/core-rest-pipeline which re-exports AbortSignalLike)
  2. Use AbortSignalLike as the parameter type in ConnectorHttpClient.sendAsync() and all generated method signatures
  3. The internal AbortController handling in sendWithRetry() stays the same — AbortController.signal implements AbortSignalLike

This is a non-breaking change (widening the accepted type is backward-compatible). Best implemented together with the AbortSignal parameter addition from PR #26 review feedback.

Azure SDK guideline

Cancellation: use AbortSignalLike

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions