When decorator metadata is copied into the output, ... in call and new arguments is lost. This changes runtime behavior, not only the setClassMetadata copy. For example, providers: f(...P) is emitted as ɵɵProvidersFeature(f(P)).
Repro
import {Component} from '@angular/core';
const P: any[] = [];
function f(...a: any[]) { return a; }
class Box { constructor(...a: any[]) {} }
@Component({selector: 'c', template: '', providers: f(...P)})
export class C {}
@Component({selector: 'c2', template: '', providers: [{provide: 'T', useValue: new Box(...P)}, ...P]})
export class C2 {}
OXC (main and #504 tip)
features:[i0.ɵɵProvidersFeature(f(P))]
// setClassMetadata
args:[{selector:"c",template:"",providers:f(P)}]
// C2
i0.ɵɵProvidersFeature([{provide:"T",useValue:new Box(P)},...P])
ngtsc 22.1.7
features: [i0.ɵɵProvidersFeature(f(...P))]
args: [{ selector: 'c', template: '', providers: f(...P) }]
i0.ɵɵProvidersFeature([{ provide: 'T', useValue: new Box(...P) }, ...P])
Array spread (...P in an array) is already kept.
Where
crates/oxc_angular_compiler/src/output/oxc_converter.rs (main): convert_call_expression_with_optional and convert_new_expression turn Argument::SpreadElement into its plain argument. They should wrap it in OutputExpression::SpreadElement, as the array path does.
Also (shape only)
A member with only non-Angular decorators is left out of the setClassMetadata prop map. ngtsc lists it with an empty array:
function Foo(): PropertyDecorator { return () => {}; }
@Component({selector: 'c', template: ''})
export class C { @Foo() x: any; @Input() y: any; }
- OXC:
{y:[{type:Input}]}
- ngtsc:
{ x: [], y: [{ type: Input }] }
Only the shape differs: the entry is an empty decorator list. Worth matching only if the compare suite needs it.
On main?
Yes, both.
When decorator metadata is copied into the output,
...in call andnewarguments is lost. This changes runtime behavior, not only thesetClassMetadatacopy. For example,providers: f(...P)is emitted asɵɵProvidersFeature(f(P)).Repro
OXC (main and #504 tip)
ngtsc 22.1.7
Array spread (
...Pin an array) is already kept.Where
crates/oxc_angular_compiler/src/output/oxc_converter.rs(main):convert_call_expression_with_optionalandconvert_new_expressionturnArgument::SpreadElementinto its plain argument. They should wrap it inOutputExpression::SpreadElement, as the array path does.Also (shape only)
A member with only non-Angular decorators is left out of the
setClassMetadataprop map. ngtsc lists it with an empty array:{y:[{type:Input}]}{ x: [], y: [{ type: Input }] }Only the shape differs: the entry is an empty decorator list. Worth matching only if the compare suite needs it.
On main?
Yes, both.