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

Is moduleId a reserved Keyword in Angular? #5509

Closed
rahulrsingh09 opened this issue Mar 19, 2017 · 2 comments · Fixed by #5510
Closed

Is moduleId a reserved Keyword in Angular? #5509

rahulrsingh09 opened this issue Mar 19, 2017 · 2 comments · Fixed by #5510
Labels
freq1: low Only reported by a handful of users who observe it rarely severity2: inconvenient

Comments

@rahulrsingh09
Copy link

export class AppComponent {
title = 'app works!';

constructor() {

  let test1 = {
        id: 'test',
        moduleId1: 'moduleId1',
        moduleId: 'IsThisReserverdWord',
        moduleId2: 'moduleId2'
    };

  console.log(test1.moduleId);

  let test2 = {
        moduleId: 'moduleId3',
    };

}
It is very strange that the console log part is never hit and there is no exception. By removing the moduleId: 'IsThisReserverdWord' property it is all fine.

Is moduleid reserved key word as when i try and print the moduleId without having any other property in test it gives undefined and also if i try and print moduleId2 in the above test object it throws error test1 is not defined.

Issue was previously opened in Angular github link

@filipesilva
Copy link
Contributor

It is reserved... of sorts. It's a compromise we made to seamlessly support a lot of existing documentation that does use moduleId: module.id.

So we remove it when we parse app code. We know this isn't ideal.

@filipesilva filipesilva added command: build freq1: low Only reported by a handful of users who observe it rarely severity2: inconvenient labels Mar 19, 2017
hansl added a commit to hansl/angular-cli that referenced this issue Mar 19, 2017
Prior to this we were removing all mentions of moduleId, which is invalid if the users want
to use it themselves. Now we only removes it if its in a decorator. There might be a slight
regression with people using static const objects instead of object literals in their
decorators but this shuold not happen often and even less often with moduleId.

Fixes angular#5509.
hansl added a commit to hansl/angular-cli that referenced this issue Mar 20, 2017
Prior to this we were removing all mentions of moduleId, which is invalid if the users want
to use it themselves. Now we only removes it if its in a decorator. There might be a slight
regression with people using static const objects instead of object literals in their
decorators but this shuold not happen often and even less often with moduleId.

Fixes angular#5509.
hansl added a commit that referenced this issue Mar 20, 2017
Prior to this we were removing all mentions of moduleId, which is invalid if the users want
to use it themselves. Now we only removes it if its in a decorator. There might be a slight
regression with people using static const objects instead of object literals in their
decorators but this shuold not happen often and even less often with moduleId.

Fixes #5509.
@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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
freq1: low Only reported by a handful of users who observe it rarely severity2: inconvenient
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants