Skip to content

Not compiling/reading files correctly #5634

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

Closed
hassanasad opened this issue Mar 24, 2017 · 16 comments
Closed

Not compiling/reading files correctly #5634

hassanasad opened this issue Mar 24, 2017 · 16 comments
Labels
effort2: medium (days) P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity2: inconvenient type: bug/fix

Comments

@hassanasad
Copy link

- [x ] bug report
- [ ] feature request

Versions.

@angular/cli: 1.0.0
node: 7.7.4
os: darwin x64
@angular/common: 4.0.0
@angular/compiler: 4.0.0
@angular/core: 4.0.0
@angular/forms: 4.0.0
@angular/http: 4.0.0
@angular/platform-browser: 4.0.0
@angular/platform-browser-dynamic: 4.0.0
@angular/router: 4.0.0
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.0

When i modify and save my files, i see Angular-cli generating the chunks again - However its not reading the files content and is still giving errors. I have to exit and re-run ng serve before it stops giving errors.

For instance, i have an interface:

export interface ISignup {
  email: string;
  password: string;
  companyName: string;
  companyRole: string;
  firstName: string;
  lastName: string;
  phone: string;
  country: string;
}

Which i renamed to SignupInterface but the compiler is still giving error:

Module '"/app/signup/signup.model"' has no exported member 'SignupInterface'.

After exiting and re-running ng serve the problem gets fixed but its really annoying having to change properties/class/interface names and then re-running compiler

@filipesilva filipesilva added package4: @angular-sdk/webpack P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix labels Mar 24, 2017
@filipesilva
Copy link
Contributor

Heya, does this only happen on interfaces?

@hassanasad
Copy link
Author

@filipesilva it happens for classes aswell.

Renaming a class doesn't register unless i restart the CLI.

@ctrl-brk
Copy link

Same happens to me with ng test (4.0.0-rc.5)

@sumitarora
Copy link
Contributor

@hassanasad I was not able to replicate it on classes. But I can confirm it only happens in the case of interfaces so seems to be an issue with interfaces. On running ng serve it only picks the interfaces already defined. Making any consecutive change in the interface doesn't pick up the changes. Shows below error.

ERROR in /Users/sumitarora/workspace/open-source/temp/aa/src/app/app.component.ts (17,5): Type '{ email: string; p2: string; }' is not assignable to type 'Signup'.
  Object literal may only specify known properties, and 'p2' does not exist in type 'Signup'.

Changing password to p2 in the interface.

export interface Signup {
  email: string;
  password: string;
}

@hassanasad
Copy link
Author

@sumitarora that is weird - its same for me on classes and interfaces both. Perhaps might be because i have both in the same file which i am testing with?

@hassanasad
Copy link
Author

@filipesilva, @sumitarora Ah - it happens for classes as well IF the file contains an interface.

For instance:

export class SignupModel {
  constructor(
    email: string,
    password: string,
    companyName: string,
    companyRole: string,
    firstName: string,
    lastName: string,
    phone: string,
    country: string,
  ) {  }
}

export interface SignupInterface {
  email: string;
  password: string;
  companyName: string;
  companyRole: string;
  firstName: string;
  lastName: string;
  phone: string;
  country: string;
}

@blakejolley
Copy link

I'm having the same issues. I previously had the issues in beta 30, but got around it by downgrading @ngtools/webpack to version 1.2.4

Changes to html files will be reflected in the browser after rebundling. Changes to .ts files seem to trigger a rebundle, however do not get reflected in the browser until a new ng serve is run

@angular/cli: 1.0.0
node: 7.7.4
npm: 4.3.0
os: windows 10
"@angular/common": "4.0.0",
"@angular/compiler": "4.0.0",
"@angular/core": "4.0.0",
"@angular/forms": "4.0.0",
"@angular/http": "4.0.0",
"@angular/platform-browser": "4.0.0",
"@angular/platform-browser-dynamic": "4.0.0",
"@angular/router": "4.0.0",

"@angular/cli": "1.0.0",
"@angular/compiler-cli": "4.0.0",

@paullessing
Copy link

I'm having this issue with custom typings, even when it's not in separate files.
I was trying to add custom matchers to Jasmine, and it's failing. Here's a minimal reproducible example:

In a fresh install ([email protected], [email protected], typescript@~2.2.0), all I've changed is app.component.spec.ts:

import { async } from '@angular/core/testing';
import { AppComponent } from './app.component';

declare namespace jasmine {
  interface Matchers {
    toUseCustomMatcher(): boolean;
  }
}

describe('AppComponent', () => {
  beforeEach(() => {
    jasmine.addMatchers({
      toUseCustomMatcher: () => ({ compare: (expected) => ({ pass: true }) })
    });
  });

  it('should foo', async(() => {
    expect(null).toUseCustomMatcher();
  }));
});

This will pass on the first run, and on all subsequent runs throws error:

ERROR in /myworkspace/src/app/app.component.spec.ts (18,18): Property 'toUseCustomMatcher' does not exist on type 'Matchers'.

If anyone has a workaround other than --single-run, I'd be very grateful for input.

@nerdmax
Copy link

nerdmax commented Sep 14, 2017

+1

@nerdmax
Copy link

nerdmax commented Sep 14, 2017

Same issues. "@angular/cli": "1.4.1"

@damienwebdev
Copy link

Still seeing this in "@angular/cli": "1.4.2"

@WaleedMKasem
Copy link

still in "@angular/cli": "1.4.5",

@uloga
Copy link

uloga commented Nov 5, 2017

+1 I have the same issue with class based typing's and the class doesn't contain any interfaces.

@uloga
Copy link

uloga commented Nov 5, 2017

Ok, I've changed all the classes to interfaces, seems to be working now. Still using older version of cli @angular/cli: 1.2.6

@hansl hansl removed their assignment Feb 6, 2018
@alan-agius4
Copy link
Collaborator

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

@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 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
effort2: medium (days) P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity2: inconvenient type: bug/fix
Projects
None yet
Development

No branches or pull requests