-
Notifications
You must be signed in to change notification settings - Fork 25.6k
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
[RC.x] Injecting missing import throws Cannot read property query of null #8245
Comments
With RC.x an error is thrown but it's not really helpful
http://plnkr.co/edit/fkeQoc562NIEWJh2WwMd?p=preview Title updated to reflect the changes in RC.x |
This is not really about missing imports. To be more exact is about injecting undefined items in the constructor, for a repro using custom classes. For a repro see the plnkr on this issue #8573 |
@ericmartinezr I'm trying to reproduce this under non-plunker conditions (ng2 test suite) and it is super-hard since if you compile things with TS you are going to get a very descriptive error: So I'm starting to suspect that this is more of a TS + SystemJS thing. I mean: it should have been reported by SystemJS. I will try some more to reproduce this under non-plunker conditions but it would be interesting to check with you / anyone else if you've ever seen this error outside plunks / SystemJS? |
@pkozlowski-opensource you're absolutely right, I can't reproduce it outside a plnkr, compilers and IDE complain. That being said there's clearly a regression on the error message as stated in the original message, previous beta.16 the error message was clear
Now it's that Should we assume then that we all must be using IDE + compiler? In that case we won't see this error message and angular could avoid checking against it. |
@pkozlowski-opensource Hi, I just used plunker to share the problem, issue is exactly the same with tsc. |
Nope. It just that it is not as severe as was initially thinking. Anyway, I've managed to reproduce it by declaring dependency on an interface (which are undefined after TS transpiles).
Yes, it clearly is and this is why we need to fix it. On it. |
If you take my plunk and replace rc.1 by rc.2 in config.js, you will see that the error message has changed "Can't resolve all parameters for ManageDefinitions" but is still there. |
@rlegrand you have a circular import ManageDefinitions imports MenuService and MenuService imports ManageDefinitions, that's causing your issue. |
Ahhh ok! |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Hard to explain in the title
Steps to reproduce and a minimal demo of the problem
See http://plnkr.co/edit/BpjzGxQU5CEStzmWdWfh?p=preview , note that I correctly imported Renderer, but I forgot to add ElementRef. Renderer is undefined when it shouldn't.
What steps should we try in your demo to see the problem?
Run the plnkr and see the console
Current behavior
Now if I inject something I forgot to import no error is thrown and all of the classes injected in the constructor are undefined, even if they're correctly imported
Expected/desired behavior
It should work as <= b.15 throwing an error like
See plnkr http://plnkr.co/edit/aP6UWXsDOYaz3yV9U7Pp?p=preview with b.15
Other information
The text was updated successfully, but these errors were encountered: