angular-architects / ngrx-toolkit

Various Extensions for the NgRx Signal Store
MIT License
98 stars 16 forks source link

Pass empty object to WithRedux action with `noPayload` #34

Closed Chudroy closed 2 months ago

Chudroy commented 2 months ago

I have these actions.

import {
  payload,
} from '@angular-architects/ngrx-toolkit';

...

  actions: {
      public: {
        loadAll: noPayload,
        loadInstallationDetail: payload<{ installationId: string }>(),
        reset: noPayload,
      },

...

in my component, i have to call/dispatch the action that doesn't have a payload with an empty object as an argument like so:

this.installationsStore.loadAll({});

Otherwise I get the following error:

Expected 1 arguments, but got 0.ts(2554)
with-redux.d.ts(15, 35): An argument for 'payload' was not provided.
(property) loadAll: (payload: {}) => {
    type: "loadAll";
}

Proposed fix: not to have to pass an empty object.

rainerhahnekamp commented 2 months ago

Has been fixed in version 0.3.0