tryChangeState
Signature
function tryChangeState( from: string | string[], to: string, opt?: ChangeOption): voidSource
export function tryChangeState( from: string | string[], to: string, opt: ChangeOption = { ignoreError: true }) { ChangeState(from, to, opt)}ChangeState(from, to, opt) returns a (target, propertyKey, descriptor) => void decorator function, but tryChangeState neither returns it nor applies it.
If you need “try to change state”
Use @ChangeState with ignoreError: true:
@ChangeState('idle', 'done', { ignoreError: true })async fetch() { await mayFail()}On failure, an FSMError is returned (not rejected) and the state auto-rolls back.