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

Cli rc.0 fails to compile on interface property name change #5114

Closed
renevall opened this issue Feb 28, 2017 · 9 comments
Closed

Cli rc.0 fails to compile on interface property name change #5114

renevall opened this issue Feb 28, 2017 · 9 comments
Assignees
Labels
effort2: medium (days) P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful severity5: regression type: bug/fix workaround2: non-obvious

Comments

@renevall
Copy link

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
El Capitan

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:
@angular/cli: 1.0.0-rc.0

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.

1 . Have an exported model, say refund.
2. Use it on a component, and assign a value to the object with the corrects interface/class members.
3. Rename or add a member to the interface, update the assignment on the component.
4. The compiler will throw a error as if there is no property with the new name/.

The log given by the failure.

Normally this include a stack trace and some more information.

ERROR in /Users/reneval/Development/Angular2/office/src/app/refunds/refund-list/refund-list.component.ts (62,29): Property 'comments' does not exist on type 'Refund'.)
/Users/reneval/Development/Angular2/office/src/app/refunds/refund-list/refund-list.component.ts (110,7): Type '{ id: number; amount: number; date: string; check_number: any; comments: any; reviewed: any; }' is not assignable to type 'Refund'.
Object literal may only specify known properties, and 'comments' does not exist in type 'Refund'.)

Mention any other details that might be useful.

This happens even if I reload page. Only after I stop and start the cli again, the error goes away


Thanks! We'll be in touch soon.

@ClemensSchneider
Copy link

This happens with 1.0.0.beta32, too.

@filipesilva
Copy link
Contributor

Does this still happen?

@filipesilva filipesilva added the needs: more info Reporter must clarify the issue label May 23, 2017
@flackjap
Copy link

@filipesilva Yes this still happens. I just stumbled upon this weird error and googled this issue.

@flackjap
Copy link

flackjap commented Jun 21, 2017

I see there's a "need: more info" label, but the OP ( @ReneVallecillo ) pretty much posted everything there is to this.

These are the versions I have installed:

@angular/cli: 1.1.2
node: 6.10.0
os: linux x64
@angular/common: 4.2.3
@angular/compiler: 4.2.3
@angular/core: 4.2.3
@angular/forms: 4.2.3
@angular/http: 4.2.3
@angular/platform-browser: 4.2.3
@angular/platform-browser-dynamic: 4.2.3
@angular/router: 4.2.3
@angular/cli: 1.1.2
@angular/compiler-cli: 4.2.3
@ngtools/webpack: 1.4.1


  1. Create a file which will hold only one simple Interface
    e.g. -> export interface User { id: number; username: string; password: string; }

  2. Start the webpack server with ng serve (no options needed) but it must watch for changes

  3. Add a new property to the Interface
    e.g. -> export interface User { id: number; username: string; password: string; admin: boolean; }

  4. In your existing or newly generated component try adding the newly defined admin property to your object that implements the aforedefined (is this a word at all?) and changed Interface. After you save a file, the compiler should generate the error reported by ReneVallecillo.

There is one thing however. I am lying. I didn't reproduce this with a clean new project, but I'm pretty sure that the environment around this particular problem I have is pretty close to it. I am only importing one Interface, from one file and then creating an object literal that has a type of the Interface I am changing.
e.g. -> const initialState : User = { id: null, username: 'John', password: '', admin: false }

I have to stop the ng serve and run it again if I want to continue on with developing and it is pretty exhausting oftentimes because I didn't define all the interfaces upfront but I'm rather doing it incrementally.

@flackjap
Copy link

flackjap commented Jun 21, 2017

Related issue: #5404

@filipesilva filipesilva assigned hansl and unassigned sumitarora Jun 28, 2017
@filipesilva filipesilva added effort2: medium (days) P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix severity3: broken workaround2: non-obvious and removed needs: more info Reporter must clarify the issue labels Jun 28, 2017
@filipesilva
Copy link
Contributor

@hansl it seems that changed interfaces are not being reflected in the TS program.

@e-cloud
Copy link
Contributor

e-cloud commented Jul 2, 2017

see the similar issue in TypeStrong/ts-loader#156

@hansl
Copy link
Contributor

hansl commented Feb 1, 2018

Closing this as obsolete.

@hansl hansl closed this as completed Feb 1, 2018
@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 7, 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 severity5: regression type: bug/fix workaround2: non-obvious
Projects
None yet
Development

No branches or pull requests

7 participants