-
Notifications
You must be signed in to change notification settings - Fork 45
Closed
Description
Hello,
First of all thank you for this great extension!
After updating to angular 19 and ngrx-signal store 19 withState produces typing error for class based signalStores if they have class fields.
Here is a very simple example that reproduces the problem. It modifies the example class based signal store from the ngrx faq
import {withDevtools} from '@angular-architects/ngrx-toolkit';
import {computed, Injectable} from '@angular/core';
import {patchState, signalStore, withState} from '@ngrx/signals';
@Injectable()
export class CounterStore extends signalStore(
{ protectedState: false },
withState({ count: 0 }),
withDevtools('counter-store')
) {
readonly myReadonlyProp = 42; // this produces a type error
readonly doubleCount = computed(() => this.count() * 2);
increment(): void {
patchState(this, { count: this.count() + 1 });
}
}
Expected behaviour: no type error
Observed behaviour: TS2411: Property myReadonlyProp of type 42 is not assignable to string index type (newName?: unknown) => unknown
ASDAlexey
Metadata
Metadata
Assignees
Labels
No labels