Property 'get' in type 'ToastInjector' is not assignable to the same property in base type 'Injector' – Node.js

by
Ali Hasan
angular angular-toastr ngx-toastr node.js react-typescript

Quick Fix: Update ngx-toastr to version 16.0.0 or add "skipLibCheck":true in angularCompilerOptions section of the tsconfig file.

The Problem:

In Angular 16, after an upgrade, there is a problem with the syntax of the ‘get’ property in the ‘ToastInjector’ class, which implements the ‘Injector’ interface. The error message indicates a type mismatch between the ‘get’ property in the ‘ToastInjector’ class and the ‘Injector’ base class. Specifically, the type of the ‘flags’ parameter is incompatible between the ‘InjectFlags’ type expected by the base class and the actual ‘InjectOptions & { optional?: false; }’ type provided by the ‘ToastInjector’ class.

The Solutions:

Solution 1: Add "skipLibCheck":true in tsconfig file

Update the `tsconfig.json` file by adding `"skipLibCheck":true` within the `angularCompilerOptions` section, like so:

{
  "angularCompilerOptions": {
    "skipLibCheck": true
  }
}

Q&A

How to fix Angular error: ‘Property ‘get’ in type ‘ToastInjector’ is not assignable to the same property in base type ‘Injector”?

Add "skipLibCheck":true in angularCompilerOptions section of the tsconfig file or update ngx-toastr to version 16.0.0

Video Explanation:

The following video, titled "WE BOUGHT OUR DREAM PROPERTY IN SICILY! OLIVE GROVE ...", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

https://www.patreon.com/leaw If you enjoy our content and want to help support our video production and our expedition, please become a ...