lephyrus / ngx-translate-messageformat-compiler

Advanced pluralization (and more) for ngx-translate, using standard ICU syntax which is compiled with the help of messageformat.js.
MIT License
93 stars 29 forks source link

Cannot read property 'toString' of undefined after upgrade to 4.0.0 #25

Closed chrisbenseler closed 6 years ago

chrisbenseler commented 6 years ago

After upgrade to latest release (4.0.0, that supports angular 4) the same code that works with older version (3.x, and angular 5.2) does not work anymore.

The app is built, but the browser outputs

core.js:1601 ERROR TypeError: Cannot read property 'toString' of undefined at _stringify (runtime.js:97) at _stringify (runtime.js:103) at Runtime.push.../../node_modules/messageformat/lib/runtime.js.Runtime.toString (runtime.js:118) at MessageFormat.push.../../node_modules/messageformat/lib/messageformat.js.MessageFormat.compile (messageformat.js:343) at TranslateMessageFormatCompiler.push.../../node_modules/ngx-translate-messageformat-compiler/esm5/ngx-translate-messageformat-compiler.js.TranslateMessageFormatCompiler.compileTranslations (ngx-translate-messageformat-compiler.js:25) at SafeSubscriber._next (ngx-translate-core.js:363) at SafeSubscriber.push.../../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.__tryOrUnsub (Subscriber.js:253) at SafeSubscriber.push.../../node_modules/rxjs/_esm5/internal/Subscriber.js.SafeSubscriber.next (Subscriber.js:191) at Subscriber.push.../../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber._next (Subscriber.js:129) at Subscriber.push.../../node_modules/rxjs/_esm5/internal/Subscriber.js.Subscriber.next (Subscriber.js:93)

lephyrus commented 6 years ago

It's hard to tell with this little information, but this could well be a timing problem that's surfacing now for some reason. After all, you've not only upgraded this library but ngx-translate/core and Angular as well. I'm not saying that's definitely the case, and even then it's not your fault but likely a bug in core.

If that doesn't narrow things down, you should try to minimally reproduce the problem on StackBlitz to get further help.

chrisbenseler commented 6 years ago

After upgrade all modules (using ng update), the error is not there anymore. Thanks.