Fix error with ambient type when running Universal #853
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi everyone,
this PR solves issue #773. Since this PR is a bit of a workaround, I wanted to share a few details on what I found on the issue, in case you want to search for a better solution. So please feel free to ignore the following ;-)
With View Engine and strictMetadataEmit enabled, using ambient types did throw a build-time error (Could not resolve type), even when correctly injecting a provider with
@Inject()
. Also see issue angular/angular#20351. This seems to have been fixed with Ivy: angular/angular#23395 (comment)Since Ivy seems to be doing something different here with ambient types, I thought it might be a general problem with a mixed (and correct) setup like the following:
Unfortunately, I am not able to reproduce the behaviour with a clean Angular workspace and just that setup. So something else seems to be involved in producing the error. And this is as far as I got for now.
P.S. Having strictMetadataEmit enabled did help me fix this issue, because it throws an error during build-time when using an ambient type. Just wanted to let you know, in case enabling it could help you in your workflow.
Thank you for the great library!