Romanchuk / angular-i18next

angular v10+ integration with i18next v19.4+
MIT License
131 stars 33 forks source link

Getting started with Angular v15 #98

Closed rouvenst closed 1 year ago

rouvenst commented 1 year ago

Hi there, I want to get started with this integration for using i18next with the newest Angular version (v15). Upon installation I got this error message:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: product-questionnaire@0.0.0
npm ERR! Found: @angular/common@15.0.2
npm ERR! node_modules/@angular/common
npm ERR!   @angular/common@"^15.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@">=14.0.0 <15.0.0" from angular-i18next@14.2.0
npm ERR! node_modules/angular-i18next
npm ERR!   angular-i18next@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Romanchuk commented 1 year ago

@rouvenst Hello, lib was not upgraded yet. Until i upgrade you can install it with legacy-peer-deps or via this method: https://stackoverflow.com/a/48524488/2208167

Romanchuk commented 1 year ago

@rouvenst Please try out: angular-i18next@15.0.0-0

rouvenst commented 1 year ago

@rouvenst Please try out: angular-i18next@15.0.0-0

Working fine now, thank you very much

gvlachos commented 1 year ago

@Romanchuk

I tried using angular-i18next@15.0.0-0 in my angular 15 project along with

and I am getting

Error: node_modules/angular-i18next/lib/I18NextEvents.d.ts:5:5 - error TS2416: Property 'initialized' in type 'I18NextEvents' is not assignable to the same property in base type 'ITranslationEvents'.
  Type 'BehaviorSubject<InitOptions<object>>' is not assignable to type 'BehaviorSubject<InitOptions<object> | undefined>'.
    Types of property 'observers' are incompatible.
      Type 'Observer<InitOptions<object>>[]' is not assignable to type 'Observer<InitOptions<object> | undefined>[]'.
        Type 'Observer<InitOptions<object>>' is not assignable to type 'Observer<InitOptions<object> | undefined>'.
          Type 'InitOptions<object> | undefined' is not assignable to type 'InitOptions<object>'.
            Type 'undefined' is not assignable to type 'InitOptions<object>'.

5     initialized: BehaviorSubject<i18n.InitOptions<object>>;
      ~~~~~~~~~~~

Error: node_modules/angular-i18next/lib/I18NextEvents.d.ts:11:5 - error TS2416: Property 'languageChanged' in type 'I18NextEvents' is not assignable to the same property in base type 'ITranslationEvents'.
  Type 'BehaviorSubject<string>' is not assignable to type 'BehaviorSubject<string | null>'.
    Types of property 'observers' are incompatible.
      Type 'Observer<string>[]' is not assignable to type 'Observer<string | null>[]'.
        Type 'Observer<string>' is not assignable to type 'Observer<string | null>'.
          Type 'string | null' is not assignable to type 'string'.
            Type 'null' is not assignable to type 'string'.

11     languageChanged: BehaviorSubject<string>;
       ~~~~~~~~~~~~~~~

I hope it is ok that I commented here instead of opening a new issue.