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

TypeError: Cannot read property 'xxxx' of undefined #23712

Closed
3 of 7 tasks
JohnGalt1717 opened this issue May 4, 2018 · 6 comments
Closed
3 of 7 tasks

TypeError: Cannot read property 'xxxx' of undefined #23712

JohnGalt1717 opened this issue May 4, 2018 · 6 comments

Comments

@JohnGalt1717
Copy link

JohnGalt1717 commented May 4, 2018

I'm submitting a...

[x] Bug report

Current behavior

In previous versions with the cli (6.0.0-rc.10 with 6.0.0-rc.6 of the compiler) everything was fine. IN the new version we're getting a ton of TypeError: Cannot read property 'xxx' of undefined.

ngx-quill causes this as does the following:
`
export namespace Enums {
export enum AccountTypes {
Checking = 1,
Savings = 2,
SharedDraft = 3,
}

export const AccountTypesTranslation: Structures.KeyValuePair[] = [
	{ value: AccountTypes.Checking, text: 'Checking' },
	{ value: AccountTypes.Savings, text: 'Savings' },
	{ value: AccountTypes.SharedDraft, text: 'Shared Draft' },
]

}
`

and this in app.module.ts:
import { Enums } from './api/xxx.Interfaces';

It appears that all of the Enums items are all factored out and cause undefined.

Expected behavior

Should work like 6.0.0-rc.6 (and cli rc.10) and not factor out this code causing errors.

Environment

Angular CLI: 6.0.0
Node: 8.10.0
OS: win32 x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker

Package Version

@angular-devkit/architect 0.6.0
@angular-devkit/build-angular 0.6.0
@angular-devkit/build-optimizer 0.6.0
@angular-devkit/core 0.6.0
@angular-devkit/schematics 0.6.0
@ngtools/webpack 6.0.0
@schematics/angular 0.6.0
@schematics/update 0.6.0
rxjs 6.1.0
typescript 2.7.2
webpack 4.6.0

Browser:

  • [X ] Chrome (desktop) version Latest
  • Chrome (Android) version XX
  • Chrome (iOS) version XX
  • Firefox version Latest
  • Safari (desktop) version XX
  • Safari (iOS) version XX
  • IE version 11
  • Edge version 17

For Tooling issues:

  • Node version: 8.10.0
  • Platform: Windows

##Steps to Reproduce

ng new projectname

Add a new ts file with the above snippet of typescript
Import it into app.module.
In app.component.ts import it again and attempt to use it there. Or do the same in the app.module in n APP_INITIALIZER. In both cases you'll get the above error.

@fergalmoran
Copy link

@trotyl @ericmartinezr Why the thumbs down? This is definitely an issue.

@trotyl
Copy link
Contributor

trotyl commented May 8, 2018

No reproduction, wrong repo.

@JohnGalt1717
Copy link
Author

There's a reproduction. It's clearly outlined.

What wrong repo? This is angular.

@trotyl
Copy link
Contributor

trotyl commented May 8, 2018

Duplicate of angular/angular-cli#10655, not an Angular issue.

@JohnGalt1717
Copy link
Author

Ok... well as long as someone knows...

@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
None yet
Projects
None yet
Development

No branches or pull requests

3 participants