OptionalautoArchive?: AOptionalcontrolledApply?: TravelsControlledApply<any, P>Delegate history navigation to an external authoritative state owner.
Optionaldevtools?: (event: TravelsEvent<any, P>) => voidOptional hook for external devtools or debugging timelines.
Optionalhistory?: TravelsHistory<P>Restore validated serialized history. This is equivalent to passing
initialPatches and initialPosition directly, but preserves the first-class
persistence API shape returned by Travels.deserialize(...).
OptionalinitialPatches?: TravelPatches<P>The initial patches of the history
OptionalinitialPosition?: numberThe initial position in the history, by default 0
OptionalmaxHistory?: numberThe maximum number of history to keep, by default 10
Optionalmutable?: booleanWhether to mutate the state in place (for observable state like MobX, Vue, Pinia) When true, apply patches directly to the existing state object When false (default), create new immutable state objects
OptionalonBranchDiscard?: (event: TravelsBranchDiscardEvent<P>) => voidCalled when undoing and then making a committed edit discards redo history. Root transactions report only entries that were visible before they began.
OptionalonError?: (error: Error) => voidCalled when Travels wraps a thrown core operation error. Errors raised by nested transactions are published after the root transaction settles.
OptionalonObserverError?: (event: TravelsObserverErrorEvent) => voidReceives errors thrown by notification hooks. Observer errors never roll back or interrupt an already committed state transition.
OptionalonWarning?: (warning: TravelsWarning) => voidReceives non-fatal normalization, compatibility, and migration warnings. Without this hook warnings are written to the console only in development.
OptionalstrictInitialPatches?: booleanWhether to throw when initialPatches is invalid.
When false (default), invalid patches are discarded and history starts empty.
OptionalwarnOnUnsupportedState?: booleanWarn in development about weak patch or JSON persistence semantics in
state, retained patches, or history metadata. Defaults to true.
OptionalpatchesOptions?: PConfigure patch formatting. Patches cannot be disabled because Travels uses them to implement history, navigation, and persistence.
Whether to automatically archive the current state, by default
true