scttcper / ngx-toastr

🍞 Angular Toastr
https://ngx-toastr.vercel.app
MIT License
2.5k stars 360 forks source link

i change toaster version that was my problem #1000

Open mokhtaarr opened 1 year ago

mokhtaarr commented 1 year ago
          > i have same problem and use npm install ngx-toastr --save --force .. and this error come to me Error: ../node_modules/ngx-toastr/toastr/toast-injector.d.ts:47:5 - error TS2416: Property 'get' in type 'ToastInjector' is not assignable to the same property in base type 'Injector'. Type '(token: any, notFoundValue?: T | undefined, flags?: InjectFlags | undefined) => T | ToastPackage' is not assignable to type '{ (token: ProviderToken, notFoundValue: undefined, options: InjectOptions & { optional?: false | undefined; }): T; (token: ProviderToken, notFoundValue: null | undefined, options: InjectOptions): T | null; (token: ProviderToken<...>, notFoundValue?: T | undefined, options?: InjectOptions | ... 1 more ...'. Types of parameters 'flags' and 'options' are incompatible. Type 'InjectOptions & { optional?: false | undefined; }' is not assignable to type 'InjectFlags | undefined'.

I am having this exact issue. Have you found a solution?

Originally posted by @dlp140 in https://github.com/scttcper/ngx-toastr/issues/915#issuecomment-1572670112

Rabeb1998 commented 1 year ago

Pour résoudre cette erreur, vous pouvez accéder au fichier "node_modules/ngx-toastr/toastr/toast-injector.d.ts" et essayer de modifier la signature de la méthode 'get' dans la classe 'ToastInjector' pour correspondante à celle de la classe de base 'Injecteur'. Voici comment vous pouvez le faire : get(token: any, notFoundValue?: T | undefined): T | ToastPackage ;

edobasky commented 1 year ago

adding "skipLibCheck":true in tsconfig.json worked for me

moon-web75 commented 2 months ago

I have same Problem using "ngx-toastr": "^14.3.0",

Angular CLI: 15.2.11 Node: 16.20.2 Package Manager: npm 8.11.0 OS: win32 x64

Type '(token: any, notFoundValue?: T, flags?: InjectFlags) => T | ToastPackage' is not assignable to type '{ (token: ProviderToken, notFoundValue: undefined, options: InjectOptions & { optional?: false; }): T; (token: ProviderToken, notFoundValue: null, options: InjectOptions): T; (token: ProviderToken<...>, notFoundValue?: T, options?: InjectOptions | InjectFlags): T; (token: ProviderToken<...>, notFou...'. Types of parameters 'flags' and 'options' are incompatible. Type 'InjectOptions & { optional?: false; }' is not assignable to type 'InjectFlags'.

47 get(token: any, notFoundValue?: T, flags?: InjectFlags): T | ToastPackage;