#5375·xstate

Bug: Durations defined in setup() are not strongly typed

Author: nicosamplerCreated Sep 20, 2025Updated Sep 22, 2025
Labelsbug

XState version

XState version 5

Description

According to the documentation, durations can be typed if they are defined in the setup. This is not working for me.

Expected result

I would expect it to be typed.

Actual result

As you can see in the image, I would expect the value in states.sleep.after.slotDuration222 to be marked as a TS error.

Image

Also, if I run it with the value key slotDuration222 it is not even detected as an error and the machine instantly transitions to the target. If the value provided is undefined, shouldn't it be expected to fail?

Reproduction

https://codesandbox.io/p/sandbox/9n6lym

Additional context

for some reason, the example erases this chunk of code in the setup:

delays: {
    someDelay: 10000,
  },