ngcc generates invalid property metadata
See original GitHub issueπ bug report
Affected Package
@angular/compiler-cli
/ ngcc
Description
Currently when compiling @angular/cdk/a11y
with ngcc
, the generated property metadata call (setClassMetadata
) incorrectly sets metadata for the autoCapture
property within the FocusTrap
twice.
Ι΅ngcc0.Ι΅setClassMetadata(..., {
autoCapture: [{
type: Input,
args: ['cdkTrapFocusAutoCapture']
}],
autoCapture: [],
});
This means that the first occurrence will be accidentally overwritten and the metadata is discarded. The duplication seems to happen because autoCapture
declares a getter
and a setter
.
As far as I could tell the issue is that ngcc
returns the getter and setter for reflection.getMembersOfClass(FocusTrap)
but sets decorators that are either defined on getter or setter as decorators
for both members. This then results in two properties with the same name in the setClassMetadata
call.
π¬ Minimal Reproduction
https://github.com/devversion/ivy-ngcc-generates-duplicate-prop-metadata
π₯ Exception or Error
See: https://github.com/angular/components/issues/16066
Defining the same property multiple times seems to cause an exception in IE11 with use strict
mode. This is actually reasonable as the first declaration is accidentally overwritten in an object literal.
π Your Environment
Angular Version:
@angular/*: 8.0.0-rc.4
@angular/cdk: 8.0.0-rc.1
Issue Analytics
- State:
- Created 4 years ago
- Reactions:14
- Comments:13 (3 by maintainers)
Is
freq1: low
correct for this issue? It seems a little low for an issue that breaks apps on an entire, supported, browser?@nmainardi It is fixed in 9.0.0-rc.3. You have to upgrade to atleast this version.