Skip to content

Commit 8bf1c16

Browse files
committed
refactor(cdk/portal): Deprecate ComponentType
Recommendation is to use `Type<T>` from `@angular/core` which has the exact same interface definition
1 parent 37513f5 commit 8bf1c16

File tree

3 files changed

+15
-9
lines changed

3 files changed

+15
-9
lines changed

goldens/cdk/overlay/index.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,7 @@ export class CloseScrollStrategy implements ScrollStrategy {
206206
enable(): void;
207207
}
208208

209-
// @public
209+
// @public @deprecated
210210
export interface ComponentType<T> {
211211
// (undocumented)
212212
new (...args: any[]): T;

goldens/cdk/portal/index.api.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ export class ComponentPortal<T> extends Portal<ComponentRef<T>> {
8181
viewContainerRef?: ViewContainerRef | null;
8282
}
8383

84-
// @public
84+
// @public @deprecated
8585
export interface ComponentType<T> {
8686
// (undocumented)
8787
new (...args: any[]): T;

src/cdk/portal/portal.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,30 @@
77
*/
88

99
import {
10-
TemplateRef,
11-
ViewContainerRef,
12-
ElementRef,
10+
Binding,
1311
ComponentRef,
12+
ElementRef,
1413
EmbeddedViewRef,
1514
Injector,
16-
Binding,
15+
TemplateRef,
16+
ViewContainerRef,
1717
} from '@angular/core';
1818
import {
19-
throwNullPortalOutletError,
20-
throwPortalAlreadyAttachedError,
2119
throwNoPortalAttachedError,
2220
throwNullPortalError,
21+
throwNullPortalOutletError,
22+
throwPortalAlreadyAttachedError,
2323
throwPortalOutletAlreadyDisposedError,
2424
throwUnknownPortalTypeError,
2525
} from './portal-errors';
2626

27-
/** Interface that can be used to generically type a class. */
27+
/**
28+
* Interface that can be used to generically type a class.
29+
*
30+
* @deprecated Use `Type<T>` from `@angular/core` instead.
31+
*
32+
* @breaking-change 22.0.0
33+
*/
2834
export interface ComponentType<T> {
2935
new (...args: any[]): T;
3036
}

0 commit comments

Comments
 (0)