Closed boneskull closed 5 months ago
Latest commit: 54195ec52cf2290c43aa8b88cf2158468818353d
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
regardless; if this (or the other suggestion) makes sense, I'll go in and make the change and/or fix the type tests.
Thank you for this! It seems like TS is complaining in some of the test files (you can run yarn typecheck
to check) 🕵️
cc. @Andarist
@davidkpiano I don't quite understand why the 3rd any
in AnyActorRef
was removed in dbeafeb25eed63ee1d2b027f10bc63d9937ab073 (#4905). That change seems to break some stuff anyhow. I'll create a simple reproduction for that.
But I'm wary of attempting to change anything else without further review/feedback
See https://github.com/statelyai/xstate/issues/4931 for the "other problem" I mentioned above.
There may be some overlap with #4932
@davidkpiano Yeah. I'll wait until #4932 is merged then retry on top of it.
@boneskull It's merged; please merge main
and try again?
looking
@davidkpiano OK, I rebased, but changed my strategy. Please read updated issue description
@davidkpiano I've added a changeset for this. I'm calling it "patch" since it doesn't affect any functionality. Happy to change it
AnyActorRef
is problematic for some use cases, because the result of theAnyActorRef['getSnapshot']
function is of typeany
.However, changing
AnyActorRef
to use a narrow type inActorRef
's first type argument,TSnapshot
, breaks conditional types which perform inference based onTSnapshot
.This change introduces
UnknownActorRef
, which is likeAnyActorRef
, but is not intended to be inferred from in future conditional types. A consumer can useUnknownActorRef
like so:AnyActorRef
would returnany
fromactor.getSnapshot()
, which make it unsuitable for this use-case in a strictly-typed environment.