angular-architects / ngrx-toolkit

Various Extensions for the NgRx Signal Store
MIT License
128 stars 21 forks source link

Keep store type in updateState #62

Closed brennohv closed 1 month ago

brennohv commented 1 month ago

I've noticed that when we use updateState it loses the store type, example: image

Meanwhile I got around this issue by encapsulating your function like this.

import { updateState } from '@angular-architects/ngrx-toolkit';
import { PartialStateUpdater, StateSignal } from '@ngrx/signals';
import { Prettify } from '@ngrx/signals/src/ts-helpers';

export function updateStateLib<State extends object>(
  stateSignal: StateSignal<State>,
  message: string,
  ...updaters: Array<
    Partial<Prettify<State>> | PartialStateUpdater<Prettify<State>>
  >
) {
  updateState(stateSignal, message, ...updaters);
} 

image

rainerhahnekamp commented 1 month ago

@brennohv that should fixed, in the latest version. could you please check?

brennohv commented 1 month ago

It's fixed