Skip to content

fix(RemoteCommand): restore Awaited<Output> to unwrap Promise handlers - #15814

Closed
Zelys-DFKH wants to merge 1 commit into
sveltejs:mainfrom
Zelys-DFKH:fix/remote-command-promise-unwrap
Closed

fix(RemoteCommand): restore Awaited<Output> to unwrap Promise handlers#15814
Zelys-DFKH wants to merge 1 commit into
sveltejs:mainfrom
Zelys-DFKH:fix/remote-command-promise-unwrap

Conversation

@Zelys-DFKH

Copy link
Copy Markdown
Contributor

Fixes #15763

PR #15533 removed Awaited<> from RemoteCommand type signatures, causing Promise-returning handlers to produce Promise<Promise<T>> instead of Promise<T>.

When a command handler returns Promise<T>, the Output generic is inferred as Promise<T>. Without Awaited<>, this results in a nested Promise type.

Restoring Awaited<Output> in both the call signature and updates() method ensures proper Promise unwrapping, matching the behavior of form() and query(), which use MaybePromise<Output>.

Changes

  • Restore Awaited<Output> in RemoteCommand type definition (packages/kit/types/index.d.ts)
  • Add regression test covering Promise-returning command handlers (packages/kit/test/types/remote.test.ts)

Fixes sveltejs#15763

PR sveltejs#15533 removed Awaited<> from RemoteCommand type signatures, causing
Promise-returning handlers to produce Promise<Promise<T>> instead of Promise<T>.

When a command handler returns Promise<T>, the Output generic is inferred as
Promise<T>. Without Awaited<>, this results in a nested Promise type.

Restoring Awaited<Output> in both the call signature and updates() method
ensures proper Promise unwrapping, matching the behavior of form() and query(),
which use MaybePromise<Output>.
@changeset-bot

changeset-bot Bot commented May 7, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2354ecc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@Zelys-DFKH

Copy link
Copy Markdown
Contributor Author

This fix was already merged in PR #15771. Closing as duplicate.

@Zelys-DFKH Zelys-DFKH closed this May 8, 2026
@svelte-docs-bot

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: RemoteCommand types no longer unwrap Promise after #15533

1 participant