xstate icon indicating copy to clipboard operation
xstate copied to clipboard

Add error type to Promise actors

Open svemat01 opened this issue 6 months ago • 2 comments

Adds the ability to define an error type for Promise actors, offering more precise type details for error states.

A practical use case for this is my neverthrow actor wrapper, which enables creating a promise actor from a ResultAsync function with a known error type. This allows proper handling of results with onDone and onError, avoiding the need to match against the result in onDone, which works but is more cumbersome and less clear in the inspector.

svemat01 avatar Jul 07 '25 13:07 svemat01

⚠️ No Changeset found

Latest commit: e264dacdf5167c995871f8afd488aab1b6d84383

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

changeset-bot[bot] avatar Jul 07 '25 13:07 changeset-bot[bot]

I'm not entirely sure if this qualifies as a minor or patch semver change, so feel free to respond with the best option or make the update yourself, whichever works best.

svemat01 avatar Jul 07 '25 13:07 svemat01