Decorators are not valid here error after typescript(4.9.5) and angular upgrade (16.2.12)

40 Views Asked by At

I have upgraded my project to typescript 4.9.5.After that I am facing error 'Decorators are not valid here' at @Inject .For example in the below code,it is throwing the error mentioned at @Inject(MAT_DIALOG_DATA).As far as what I know this is correct way to define the decorator in constuctors. It used to work fine before upgrade. I am getting the error in almost all the constructors where i have used decorators like

constructor(
    public dialogRef: MatDialogRef<ConfirmationDialogComponent>,
    @Inject(MAT_DIALOG_DATA) data: any
)
export class CatalystModalComponent extends ConfirmDialog implements OnInit {
    @ContentChild(Body) body;
    constructor(
        el: ElementRef,
        renderer: Renderer2,
        confirmationService: CatalystConfirmationService,
        zone: NgZone,
        cd: ChangeDetectorRef,
        config: PrimeNGConfig,
        @Inject(DOCUMENT) document: Document       
    ) {
        super(el, renderer, confirmationService, zone, cd, config, document);
    }


}

I have tried all the approaches .As for as my understanding the syntax i am using is correct

0

There are 0 best solutions below