Skip to content

Commit

Permalink
feat(core): Drop public factories property for IterableDiffers : …
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
JeanMeche authored and dylhunn committed Apr 4, 2023
1 parent 34b2d34 commit 061f3d1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
2 changes: 0 additions & 2 deletions goldens/public-api/core/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -880,8 +880,6 @@ export class IterableDiffers {
// (undocumented)
static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers;
static extend(factories: IterableDifferFactory[]): StaticProvider;
// @deprecated (undocumented)
factories: IterableDifferFactory[];
// (undocumented)
find(iterable: any): IterableDifferFactory;
// (undocumented)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -195,13 +195,7 @@ export class IterableDiffers {
static ɵprov = /** @pureOrBreakMyCode */ ɵɵdefineInjectable(
{token: IterableDiffers, providedIn: 'root', factory: defaultIterableDiffersFactory});

/**
* @deprecated v4.0.0 - Should be private
*/
factories: IterableDifferFactory[];
constructor(factories: IterableDifferFactory[]) {
this.factories = factories;
}
constructor(private factories: IterableDifferFactory[]) {}

static create(factories: IterableDifferFactory[], parent?: IterableDiffers): IterableDiffers {
if (parent != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {TestBed} from '@angular/core/testing';
const parent = IterableDiffers.create(<any>[factory1]);
const child = IterableDiffers.create(<any>[factory2], parent);

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

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

// @ts-expect-error factories is a private member
expect(injector.get<IterableDiffers>(IterableDiffers).factories).toEqual([factory1]);

// @ts-expect-error factories is a private member
expect(childInjector.get<IterableDiffers>(IterableDiffers).factories).toEqual([
factory2, factory1
]);
Expand Down

0 comments on commit 061f3d1

Please sign in to comment.