Interface SyncDeriveOptions<T, S>

interface SyncDeriveOptions<T, S> {
    derive: SyncDeriveFn<T, S>;
    equal?: ((a: T, b: T) => boolean);
    notEqual?: ((a: T, b: T) => boolean);
}

Type Parameters

  • T
  • S

Hierarchy

Properties

derive: SyncDeriveFn<T, S>
equal?: ((a: T, b: T) => boolean)

Custom function to compare two values, that should return true if they are equal.

It is called when setting a new value to avoid doing anything (such as notifying subscribers) if the value did not change.

Type declaration

    • (a, b): boolean
    • Parameters

      • a: T

        First value to compare.

      • b: T

        Second value to compare.

      Returns boolean

      true if a and b are considered equal.

The default logic (when this option is not present) is to return false if a is a function or an object, or if a and b are different according to Object.is.

equal takes precedence over notEqual if both are defined.

notEqual?: ((a: T, b: T) => boolean)

Custom function to compare two values, that should return true if they are different.

It is called when setting a new value to avoid doing anything (such as notifying subscribers) if the value did not change.

Type declaration

    • (a, b): boolean
    • Parameters

      • a: T

        First value to compare.

      • b: T

        Second value to compare.

      Returns boolean

      true if a and b are considered different.

The default logic (when this option is not present) is to return true if a is a function or an object, or if a and b are different according to Object.is.

StoreOptions.equal takes precedence over notEqual if both are defined.

Use StoreOptions.equal instead