Skip to content

fix(typescript): export and deduplicate SSE params types in public exports - #73

Draft
2ynn wants to merge 1 commit into
mainfrom
fix/typescript/per-variant-sse-params-types
Draft

2ynn wants to merge 1 commit into
mainfrom
fix/typescript/per-variant-sse-params-types

Conversation

@2ynn

@2ynn 2ynn commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

Why

In methodSignature: params-object mode, an operation-level x-speakeasy-exports entry on an SSE-overloaded operation whose request body is a union of objects only exported the base <Op>Params type. The types the method actually accepts (i.e. union-level <Op>Params{NonStreaming,Streaming} and each variant's <Member>Params{,NonStreaming,Streaming}, which include non-body parameters) were not reachable from resources.ts.

The method also declared no overload for the union-level Streaming/NonStreaming params, so passing a value of that type resolved to the catch-all overload and lost the narrowed stream return type.

…ports

In params-object mode, an operation-level x-speakeasy-exports entry on an
SSE-overloaded operation with a union-of-objects request body only exported
the base <Op>Params type. The Streaming/NonStreaming params and the
per-variant <Member>Params{,NonStreaming,Streaming} types were not
reachable from resources.ts, and the method declared no overload for the
union-level Streaming/NonStreaming params, so a value of that type resolved
to the catch-all overload and lost the narrowed stream return type.

- Methods with union bodies now also declare the union-level
  NonStreaming/Streaming overloads, after the per-variant ones.
- Every SSE operation export goes through one path: its Streaming and
  NonStreaming params are added after all explicit exports and skipped
  when the name is already taken, so explicit names keep their targets
  and duplicate members can no longer be emitted. Union-body operations
  also get each variant's full params, nested under the export's
  namespace only, so they never claim a flat alias.
- The group-level and nested aliases share one intermediate declaration,
  and the export's namespace merges into an existing child of the same
  name instead of being renamed.

For SSE operations without a request body, resources.ts no longer emits
the duplicate X$2 intermediates (exported types are unchanged), and an
explicit export that collides with a generated <Alias>Streaming or
<Alias>NonStreaming name now keeps the flat name instead of the params
type.
@github-actions github-actions Bot added the typescript Trigger (168) snapshot tests for typescript label Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

typescript Trigger (168) snapshot tests for typescript

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant