overrideWith method

Computed<T> overrideWith(
  1. T val
)

Override the current signal with a new value as if it was created with it

This does not trigger any updates

var counter = computed(() => 0);

// Override the signal with a new value
counter = counter.overrideWith(1);

Implementation

Computed<T> overrideWith(T val) {
  fn = () => val;
  flags = OUTDATED;
  // _version = 0;
  afterCreate(val);
  return this;
}