Skip to content

Commit 061f3d1

Browse files
JeanMechedylhunn
authored andcommittedApr 4, 2023
feat(core): Drop public factories property for IterableDiffers : Breaking change (#49598)
The `factories` property was marked as deprecated in v4 to make it private. Let's move it to private. PR Close #49598
1 parent 34b2d34 commit 061f3d1

File tree

3 files changed

+5
-9
lines changed

3 files changed

+5
-9
lines changed
 

‎goldens/public-api/core/index.md

-2
Original file line numberDiff line numberDiff line change
@@ -880,8 +880,6 @@ export class IterableDiffers {
880880
// (undocumented)
881881
static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers;
882882
static extend(factories: IterableDifferFactory[]): StaticProvider;
883-
// @deprecated (undocumented)
884-
factories: IterableDifferFactory[];
885883
// (undocumented)
886884
find(iterable: any): IterableDifferFactory;
887885
// (undocumented)

‎packages/core/src/change_detection/differs/iterable_differs.ts

+1-7
Original file line numberDiff line numberDiff line change
@@ -195,13 +195,7 @@ export class IterableDiffers {
195195
static ɵprov = /** @pureOrBreakMyCode */ ɵɵdefineInjectable(
196196
{token: IterableDiffers, providedIn: 'root', factory: defaultIterableDiffersFactory});
197197

198-
/**
199-
* @deprecated v4.0.0 - Should be private
200-
*/
201-
factories: IterableDifferFactory[];
202-
constructor(factories: IterableDifferFactory[]) {
203-
this.factories = factories;
204-
}
198+
constructor(private factories: IterableDifferFactory[]) {}
205199

206200
static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers {
207201
if (parent != null) {

‎packages/core/test/change_detection/differs/iterable_differs_spec.ts

+4
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ import {TestBed} from '@angular/core/testing';
4444
const parent = IterableDiffers.create(<any>[factory1]);
4545
const child = IterableDiffers.create(<any>[factory2], parent);
4646

47+
// @ts-expect-error private member
4748
expect(child.factories).toEqual([factory2, factory1]);
4849
});
4950

@@ -55,7 +56,10 @@ import {TestBed} from '@angular/core/testing';
5556
const childInjector =
5657
Injector.create({providers: [IterableDiffers.extend([factory2])], parent: injector});
5758

59+
// @ts-expect-error factories is a private member
5860
expect(injector.get<IterableDiffers>(IterableDiffers).factories).toEqual([factory1]);
61+
62+
// @ts-expect-error factories is a private member
5963
expect(childInjector.get<IterableDiffers>(IterableDiffers).factories).toEqual([
6064
factory2, factory1
6165
]);

0 commit comments

Comments
 (0)
Please sign in to comment.