From 8bf1c16dc55237181adf5f71564a9e4b25f5fa96 Mon Sep 17 00:00:00 2001 From: Matthieu Riegler Date: Thu, 19 Mar 2026 15:35:42 +0100 Subject: [PATCH] refactor(cdk/portal): Deprecate `ComponentType` Recommendation is to use `Type` from `@angular/core` which has the exact same interface definition --- goldens/cdk/overlay/index.api.md | 2 +- goldens/cdk/portal/index.api.md | 2 +- src/cdk/portal/portal.ts | 20 +++++++++++++------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/goldens/cdk/overlay/index.api.md b/goldens/cdk/overlay/index.api.md index 8690212162f8..563f1e511a65 100644 --- a/goldens/cdk/overlay/index.api.md +++ b/goldens/cdk/overlay/index.api.md @@ -206,7 +206,7 @@ export class CloseScrollStrategy implements ScrollStrategy { enable(): void; } -// @public +// @public @deprecated export interface ComponentType { // (undocumented) new (...args: any[]): T; diff --git a/goldens/cdk/portal/index.api.md b/goldens/cdk/portal/index.api.md index 5f044b53cb2f..f96703c5213d 100644 --- a/goldens/cdk/portal/index.api.md +++ b/goldens/cdk/portal/index.api.md @@ -81,7 +81,7 @@ export class ComponentPortal extends Portal> { viewContainerRef?: ViewContainerRef | null; } -// @public +// @public @deprecated export interface ComponentType { // (undocumented) new (...args: any[]): T; diff --git a/src/cdk/portal/portal.ts b/src/cdk/portal/portal.ts index c1db210cf47b..0f367726affa 100644 --- a/src/cdk/portal/portal.ts +++ b/src/cdk/portal/portal.ts @@ -7,24 +7,30 @@ */ import { - TemplateRef, - ViewContainerRef, - ElementRef, + Binding, ComponentRef, + ElementRef, EmbeddedViewRef, Injector, - Binding, + TemplateRef, + ViewContainerRef, } from '@angular/core'; import { - throwNullPortalOutletError, - throwPortalAlreadyAttachedError, throwNoPortalAttachedError, throwNullPortalError, + throwNullPortalOutletError, + throwPortalAlreadyAttachedError, throwPortalOutletAlreadyDisposedError, throwUnknownPortalTypeError, } from './portal-errors'; -/** Interface that can be used to generically type a class. */ +/** + * Interface that can be used to generically type a class. + * + * @deprecated Use `Type` from `@angular/core` instead. + * + * @breaking-change 22.0.0 + */ export interface ComponentType { new (...args: any[]): T; }