1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

How to get compiling error for setting an object value in Angular's readonly signal?...

Discussão em 'Angular' iniciado por Bjarne Gerhardt-Pedersen, Outubro 9, 2024 às 09:03.

  1. I'm declaring a readonly signal of the type Signal:

    public mySignal = signal({ id: 1 }).asReadonly();


    But i get no compiling errors if I assign a different value in the signal. I expect the compiler to catch this error. I do get a runtime error, but that is often too late and i might not catch that.

    this.mySignal().id = 1; // no compile error - i expect a compile error here


    I expect a compile error when assigning a new value to a readonly signal.

    Continue reading...

Compartilhe esta Página