Add line numbers / file name for error: "Cannot assign to a reference or variable!"
See original GitHub issueI’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 https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
When getting the error: “Cannot assign to a reference or variable!”:
- with
ng b --aot
orng b --prod
: The error consists ofERROR 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 aUnhandled 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 atvendor.bundle.js
.
Expected behavior
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
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?
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:
- Angular version: 4.1.3
- Browser: all
-
Language: TypeScript 2.1
-
Node (for AoT issues):
node --version
= v6.10.2
Issue Analytics
- State:
- Created 6 years ago
- Reactions:11
- Comments:11 (2 by maintainers)
This continues to be an issue in Angular 8
The error occurs when
"fullTemplateTypeCheck": true
in tsconfig.json.It’s not possible to find out the error, when you have no stacktrace. 😦.