Skip to content

Commit

Permalink
fix(cdk/scrolling): adds ngTemplateContextGuard (#27276)
Browse files Browse the repository at this point in the history
BREAKING CHANGE:
* Virtual scrolling lists now have proper type checking which can reveal some previously-hidden compilation errors.

* fix(cdk/scrolling): adds ngTemplateContextGuard

implements ngTemplateContextGuard for CdkVirtualForOf directive

fixes #26609

* fixup! fix(cdk/scrolling): adds ngTemplateContextGuard
  • Loading branch information
naaajii authored Sep 2, 2024
1 parent 5bd5be6 commit 5439460
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/cdk/scrolling/virtual-for-of.ts
Original file line number Diff line number Diff line change
Expand Up @@ -395,4 +395,11 @@ export class CdkVirtualForOf<T>
index,
};
}

static ngTemplateContextGuard<T>(
directive: CdkVirtualForOf<T>,
context: unknown,
): context is CdkVirtualForOfContext<T> {
return true;
}
}
2 changes: 2 additions & 0 deletions tools/public_api_guard/cdk/scrolling.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ export class CdkVirtualForOf<T> implements CdkVirtualScrollRepeater<T>, Collecti
ngDoCheck(): void;
// (undocumented)
ngOnDestroy(): void;
// (undocumented)
static ngTemplateContextGuard<T>(directive: CdkVirtualForOf<T>, context: unknown): context is CdkVirtualForOfContext<T>;
readonly viewChange: Subject<ListRange>;
// (undocumented)
static ɵdir: i0.ɵɵDirectiveDeclaration<CdkVirtualForOf<any>, "[cdkVirtualFor][cdkVirtualForOf]", never, { "cdkVirtualForOf": { "alias": "cdkVirtualForOf"; "required": false; }; "cdkVirtualForTrackBy": { "alias": "cdkVirtualForTrackBy"; "required": false; }; "cdkVirtualForTemplate": { "alias": "cdkVirtualForTemplate"; "required": false; }; "cdkVirtualForTemplateCacheSize": { "alias": "cdkVirtualForTemplateCacheSize"; "required": false; }; }, {}, never, never, true, never>;
Expand Down

0 comments on commit 5439460

Please sign in to comment.