From 9ea95dc8fce574919dd08642b63a280418f43a55 Mon Sep 17 00:00:00 2001 From: SandroMaglione Date: Mon, 9 Dec 2024 18:05:15 +0100 Subject: [PATCH] changeset `spawn` input required --- .changeset/big-pumas-search.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .changeset/big-pumas-search.md diff --git a/.changeset/big-pumas-search.md b/.changeset/big-pumas-search.md new file mode 100644 index 0000000000..9a12e6b814 --- /dev/null +++ b/.changeset/big-pumas-search.md @@ -0,0 +1,22 @@ +--- +'xstate': patch +--- + +Make `spawn` input required when defined inside referenced actor: + +```ts +const childMachine = createMachine({ + types: { input: {} as { value: number } } +}); + +const machine = createMachine({ + types: {} as { context: { ref: ActorRefFrom } }, + context: ({ spawn }) => ({ + ref: spawn( + childMachine, + // Input is now required! + { input: { value: 42 } } + ) + }) +}); +```