Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All locales from @angular/common/locales contain extra comma after ['AM', 'PM'] array #22988

Closed
marzecm opened this issue Mar 26, 2018 · 5 comments
Assignees
Labels
area: i18n refactoring Issue that involves refactoring or code-cleanup
Milestone

Comments

@marzecm
Copy link

marzecm commented Mar 26, 2018

Hi,

I'm importing many locales from @angular/common/locales (en, fr, fr-CA, ...) and I'm getting
Uncaught TypeError: Cannot read property 'visitExpression' of undefined raised by zone.js at runtime.

Current behavior

At runtime zone.js raises an error
Uncaught TypeError: Cannot read property 'visitExpression' of undefined

Expected behavior

Can use locales without errors at runtime.

Personnal investigation

It seems that the reason is that default object being exported from locale file contains 2 extra commas at default[2] which is right after ['AM', 'PM'],,
This extra comma is present in ALL files from @angular/common/locales.

example: https://github.com/angular/angular/blob/master/packages/common/locales/fr.ts at line 21-22 commas should be removed

in english version https://github.com/angular/angular/blob/master/packages/common/locales/en.ts
the extra comma is also present at default[1] at line 22

Can you please clean those files from this extra comma?

@ngbot ngbot bot added this to the needsTriage milestone Mar 26, 2018
@marzecm marzecm changed the title All locales from @angular/common/locales contain extra comma after ['AM', 'PM'] array - Uncaught TypeError: Cannot read property 'visitExpression' of undefined raised by zone.js All locales from @angular/common/locales contain extra comma after ['AM', 'PM'] array Mar 26, 2018
@trotyl
Copy link
Contributor

trotyl commented Mar 26, 2018

It's by design, [42, ] is equivalent to [42, undefined] but saved many space.

Also it's not undefined in many locales like https://github.com/angular/angular/blob/master/packages/common/locales/br.ts

@guilhermevrs
Copy link

Hey
I am having the exact the same error.

I understand what your point @trotyl, so perhaps a fix should be made in the JIT interpreter? (at least on my case, building my app on AoT seems to fix the issue, but I also want to use the JIT)

@trotyl
Copy link
Contributor

trotyl commented Mar 26, 2018

Please provide reproduction for any of your problem.

@vicb vicb added the refactoring Issue that involves refactoring or code-cleanup label Mar 26, 2018
@vicb
Copy link
Contributor

vicb commented Mar 26, 2018

The issue is not with the interpreter: [42, ] and [42, undefined] will work equally well. Without a repro we can not know what is wrong.
However our plan is to change the sparse array and have explicit undefined because it already caused troubles with some webpack plugins

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: i18n refactoring Issue that involves refactoring or code-cleanup
Projects
None yet
Development

No branches or pull requests

6 participants