Skip to content

Commit

Permalink
docs(signals): clarify that signal type can only be an object literal.
Browse files Browse the repository at this point in the history
Closes ngrx#4316
  • Loading branch information
rainerhahnekamp committed May 12, 2024
1 parent 22a3adf commit 8794352
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion projects/ngrx.io/content/guide/signals/signal-state.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ const userState = signalState<UserState>({
});
```

As a result, it returns an extended version of a signal that possesses all the capabilities of a read-only signal.
The state's type must be a record/object literal. Add arrays or primitive values to properties.

`signalState` returns an extended version of a signal that possesses all the capabilities of a read-only signal.

```ts
import { computed, effect } from '@angular/core';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Through the combination of store features, the SignalStore gains state, computed
Based on the utilized features, the `signalStore` function returns an injectable service that can be provided and injected where needed.

The `withState` feature is used to add state properties to the SignalStore.
This feature accepts initial state as an input argument.
This feature accepts initial state as an input argument. As with `signalState`, the state's type must be a record/object literal.

<code-example header="books.store.ts">

Expand Down

0 comments on commit 8794352

Please sign in to comment.