fix(ivy): remove unnecessary parameter of NgOnChangesFeature (#21879)
PR Close #21879
This commit is contained in:
parent
8b14488827
commit
65cf1add97
|
@ -67,10 +67,9 @@ type OnChangesExpando = OnChanges & {
|
|||
[key: string]: any;
|
||||
};
|
||||
|
||||
export function NgOnChangesFeature<T>(type: Type<T>): (definition: DirectiveDef<any>) => void {
|
||||
return function(definition: DirectiveDef<any>): void {
|
||||
export function NgOnChangesFeature(definition: DirectiveDef<any>): void {
|
||||
const inputs = definition.inputs;
|
||||
const proto = type.prototype;
|
||||
const proto = definition.type.prototype;
|
||||
// Place where we will store SimpleChanges if there is a change
|
||||
Object.defineProperty(proto, PRIVATE_PREFIX, {value: undefined, writable: true});
|
||||
for (let pubKey in inputs) {
|
||||
|
@ -119,7 +118,6 @@ export function NgOnChangesFeature<T>(type: Type<T>): (definition: DirectiveDef<
|
|||
delegateHook && delegateHook.apply(this);
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ NgForOf.ngDirectiveDef = defineDirective({
|
|||
factory: () => new NgForOfDef(
|
||||
injectViewContainerRef(), injectTemplateRef(),
|
||||
inject(IterableDiffers, InjectFlags.Default, defaultIterableDiffers)),
|
||||
features: [NgOnChangesFeature(NgForOf)],
|
||||
features: [NgOnChangesFeature],
|
||||
inputs: {
|
||||
ngForOf: 'ngForOf',
|
||||
ngForTrackBy: 'ngForTrackBy',
|
||||
|
|
|
@ -426,7 +426,7 @@ describe('compiler specification', () => {
|
|||
factory: () => new LifecycleComp(),
|
||||
template: function(ctx: any, cm: boolean) {},
|
||||
inputs: {nameMin: 'name'},
|
||||
features: [r3.NgOnChangesFeature(LifecycleComp)]
|
||||
features: [r3.NgOnChangesFeature]
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ describe('define', () => {
|
|||
static ngDirectiveDef = defineDirective({
|
||||
type: MyDirective,
|
||||
factory: () => new MyDirective(),
|
||||
features: [NgOnChangesFeature(MyDirective)],
|
||||
features: [NgOnChangesFeature],
|
||||
inputs: {valA: 'valA', valB: 'valB'}
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue