Type 'Signal<boolean>' is not assignable to type 'Signal<unknown>'

Discussão em 'Angular' iniciado por Max, Abril 25, 2025.

  1. Max

    Max Guest

    I am working on an app which is using a pretty simple signal store. It worked the last days but suddenly today I got the following error:

    Type 'Signal<boolean>' is not assignable to type 'Signal<unknown>'.
    Type 'Signal<boolean>' is not assignable to type '{ [SIGNAL]: unknown; }'.ts(2322)


    The strange thing is that I didn't change anything, and the examples on the NgRx page are exactly the same. Even when I copy the code into another repository it works.

    I already tried to reinstall everything even with different versions.

    import { signalStore, withComputed, withState } from '@ngrx/signals';
    import { computed } from '@angular/core';

    type ProjectState = {
    projects: {name: string}[];
    isLoading: boolean;
    };

    const initialState: ProjectState = {
    projects: [{ name: 'test' }],
    isLoading: false
    };

    export const ProjectStore = signalStore(
    { providedIn: 'root' },
    withState(initialState),
    withComputed(({ projects }) => ({
    hasProjects: computed(() => !!projects().length)
    }))
    );


    I am using Angular 19.2.6, @ngrx/signals 19.1.0 and NX 20.8.0. What could cause this?

    Continue reading...

Compartilhe esta Página