`@dynamic` is suppressing a metadata error
See original GitHub issueI’m submitting a…
[] Regression (a behavior that used to work and stopped working in a new release)
[X] Bug report
[ ] Feature request
[ ] Documentation issue or request
[ ] Support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
I am bundling a library and having set skipTemplateCodegen
and strictMetadataEmit
to true
.
When passing a lambda funtion to a decorator
an metadata error is emitted during compilation. Marking it with @dynamic
has no effect, and in fact I get
Error encountered in metadata generated for exported symbol 'Foo': Metadata collected contains an error that will be reported at runtime: Lambda not supported.
When I switch skipTemplateCodegen
and strictMetadataEmit
to false
I also have an error
TypeError: Cannot read property 'kind' of undefined
Expected behavior
Lambda calls can be used in decorators with the @dynamic
. In all fairness I am still a bit confused for what to use the @dynamic
, And my question would be is there a way to use lamba function inside decorators or this is by design that you cannot use it?
Minimal reproduction of the problem with instructions
https://github.com/alan-agius4/angular5-dynamic-supress-meta-error
What is the motivation / use case for changing the behavior?
In Angular 4 this used to work because the error was not emitted as I believe there was no validation happening, I checked the metadata and indeed there is an error in the meta data.
{
"__symbolic": "method",
"decorators": [
{
"__symbolic": "error",
"message": "Function call not supported",
"line": 7,
"character": 6,
"module": "./src/foo"
}
]
}
Environment
Angular version: 5.1.X
Browser:
- [ ] Chrome (desktop) version XX
- [ ] Chrome (Android) version XX
- [ ] Chrome (iOS) version XX
- [ ] Firefox version XX
- [ ] Safari (desktop) version XX
- [ ] Safari (iOS) version XX
- [ ] IE version XX
- [ ] Edge version XX
For Tooling issues:
- Node version: 8.9.0
- Platform: Windows
Issue Analytics
- State:
- Created 6 years ago
- Reactions:5
- Comments:5 (4 by maintainers)
The comment should have worked.
Partial for documentation for this is coming in #21135.
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.