Skip to content

Commit 70bc4d5

Browse files
mina-skunkjelbourn
authored andcommitted
fix(portal): correct return type of TemplatePortal.attach (#14602)
Fixes #14584 BREAKING CHANGE The return type of `TemplatePortal.attach` previously had an incorrect signature: `TemplatePortal<C>.attach(...): C`. This should actually have been `TemplatePortal<C>.attach(...): EmbeddedViewRef<C>`. The type has been corrected.
1 parent 99f3c2d commit 70bc4d5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/cdk/portal/portal.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ export class ComponentPortal<T> extends Portal<ComponentRef<T>> {
116116
/**
117117
* A `TemplatePortal` is a portal that represents some embedded template (TemplateRef).
118118
*/
119-
export class TemplatePortal<C = any> extends Portal<C> {
119+
export class TemplatePortal<C = any> extends Portal<EmbeddedViewRef<C>> {
120120
/** The embedded template that will be used to instantiate an embedded View in the host. */
121121
templateRef: TemplateRef<C>;
122122

@@ -142,7 +142,7 @@ export class TemplatePortal<C = any> extends Portal<C> {
142142
* When a context is provided it will override the `context` property of the `TemplatePortal`
143143
* instance.
144144
*/
145-
attach(host: PortalOutlet, context: C | undefined = this.context): C {
145+
attach(host: PortalOutlet, context: C | undefined = this.context): EmbeddedViewRef<C> {
146146
this.context = context;
147147
return super.attach(host);
148148
}

0 commit comments

Comments
 (0)