Skip to main content

TypedItemValidateOption

Callable


  • Validates a selected option. A typed item may provide a custom validation function. Returning a non-empty string from the validation function indicates that the new option is not compatible with the character's current state (generally due to prerequisites or other requirements).


    Type parameters

    Parameters

    • data: ExtendedItemData<T>
    • C: Character

      The character on whom the item is equipped

    • item: Item

      The item whose options are being validated

    • option: T

      The new option

    • previousOption: T

      The previously applied option

    • optionalpermitExisting: boolean = false

      Determines whether the validation should allow the new option and previous option to be identical. Defaults to false.

    Returns string

    • undefined or an empty string if the validation passes. Otherwise, returns a string message informing the player of the requirements that are not met.