angular-architects / ngrx-toolkit

Various Extensions for the NgRx Signal Store
MIT License
177 stars 23 forks source link

Keep store type in updateState #62

Closed brennohv closed 4 months ago

brennohv commented 4 months 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 4 months ago

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

brennohv commented 4 months ago

It's fixed