Useful or not, from you.
angular Add line numbers / file name for error: "Cannot assign to a reference or variable!"


I'm submitting a ... (check one with "x")

[x] bug report => search github for a similar issue or PR before submitting
[x] feature request
[ ] support request => Please do not submit support request here, instead see

Current behavior <!-- Describe how the bug manifests. --> When getting the error: "Cannot assign to a reference or variable!":

  • with ng b --aot or ng b --prod: The error consists of ERROR in Cannot assign to a reference or variable! with no line number or file. The following error is the entire module failing to be resolved.
  • with ng b: The error occurs at runtime instead, giving a Unhandled Promise rejection: Cannot assign to a reference or variable! ; Zone: <root> ; Task: Promise.then ; Value: Error: Cannot assign to a reference or variable!, and the stack trace points at vendor.bundle.js.

Expected behavior <!-- Describe what the behavior would be without the bug. --> When getting the error: "Cannot assign to a reference or variable!", there should be a file and line number associated with the error.

At the very least, including a component name with the error would suffice in my case.

Minimal reproduction of the problem with instructions <!-- If the current behavior is a bug or you can illustrate your feature request better with an example, please provide the STEPS TO REPRODUCE and if possible a MINIMAL DEMO of the problem via or similar (you can use this template as a starting point: --> plunker link. Error shows up in console, but doesn't point the the source of the problem.

What is the motivation / use case for changing the behavior? <!-- Describe the motivation or the concrete use case --> Errors should point towards the thing that caused the error. Especially useful since I'm pretty sure I have this error in many places.

Please tell us about your environment: <!-- Operating system, IDE, package manager, HTTP server, ... -->

  • Angular version: 4.1.3 <!-- Check whether this is still an issue in the most recent Angular version -->

  • Browser: all <!-- All browsers where this could be reproduced -->

  • Language: TypeScript 2.1

  • Node (for AoT issues): node --version = v6.10.2

That's a useful answer
Without any help

This continues to be an issue in Angular 7.