angular-i18next: Build error when updating to 14.2.0 with strict typing

Build error when updating to 14.2.0

Compiling with Angular sources in Ivy partial compilation mode.
 ✖ Compiling with Angular sources in Ivy partial compilation mode.
node_modules/.pnpm/angular-i18next@14.2.0_ast4p4ycywo3bpfejuahudj7lm/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>' is not assignable to type 'BehaviorSubject<InitOptions | undefined>'.
     Types of property 'observers' are incompatible.
       Type 'Observer<InitOptions>[]' is not assignable to type 'Observer<InitOptions | undefined>[]'.
         Type 'Observer<InitOptions>' is not assignable to type 'Observer<InitOptions | undefined>'.
           Type 'InitOptions | undefined' is not assignable to type 'InitOptions'.
             Type 'undefined' is not assignable to type 'InitOptions'.
 
 5     initialized: BehaviorSubject<i18n.InitOptions>;
       ~~~~~~~~~~~
 node_modules/.pnpm/angular-i18next@14.2.0_ast4p4ycywo3bpfejuahudj7lm/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 think has something to do with: tsconfig.json "compilerOptions": { "strict": true, },

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 2
  • Comments: 24 (11 by maintainers)

Most upvoted comments

I have found setting the "skipLibCheck": true in the tsconfig.json also helps

angular-i18next: 15.0.4 works with i18next 22 on my library, next week we are going to angular v15, so angular v14 is for us not important. Thank you for the fix and support. For me issue can be closed.

@marcovmun Completely changed build config (custom). Please try:
15.0.3

sorry for editing but it is still failing to compile and only when setting strict to false does it work!

@Romanchuk @marcovmun @jemand771

@Romanchuk I’m also having this problem but I cannot upgrade to version 15.0.0-0 because its forcing angular version to be 15 and we’re still at 14…

Hey, i am going through the same problem. Any idea when this would be resolved?