Skip to content

Not compiling/reading files correctly #5634

Closed

Description

@hassanasad
- [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

Activity

  1. filipesilva commented on Mar 24, 2017

    @filipesilva
    Contributor

    Heya, does this only happen on interfaces?

  2. hassanasad commented on Mar 24, 2017

    @hassanasad
    Author

    @filipesilva it happens for classes aswell.

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

  3. ctrl-brk commented on Mar 24, 2017

    @ctrl-brk

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

  4. sumitarora commented on Mar 24, 2017

    @sumitarora
    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;
    }
    
  5. hassanasad commented on Mar 24, 2017

    @hassanasad
    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?

  6. hassanasad commented on Mar 24, 2017

    @hassanasad
    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;
    }
    
  7. blakejolley commented on Mar 24, 2017

    @blakejolley

    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",

  8. paullessing commented on Mar 30, 2017

    @paullessing

    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 (cli@1.0.0, angular@4.0.0, 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.

  9. nerdmax commented on Sep 14, 2017

    @nerdmax

    +1

  10. nerdmax commented on Sep 14, 2017

    @nerdmax

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

  11. damienwebdev commented on Sep 21, 2017

    @damienwebdev

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

  12. WaleedMKasem commented on Oct 10, 2017

    @WaleedMKasem

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

  13. uloga commented on Nov 5, 2017

    @uloga

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

  14. uloga commented on Nov 5, 2017

    @uloga

    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

  15. removed their assignment
    on Feb 6, 2018
  16. alan-agius4 commented on Dec 10, 2018

    @alan-agius4
    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.

  17. angular-automatic-lock-bot commented on Sep 9, 2019

    @angular-automatic-lock-bot

    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.

  18. locked and limited conversation to collaborators on Sep 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions