-
Notifications
You must be signed in to change notification settings - Fork 27.1k
Closed
Closed
Copy link
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: commonIssues related to APIs in the @angular/common packageIssues related to APIs in the @angular/common packagebugcross-cutting: typesstate: has PR
Milestone
Description
Which @angular/* package(s) are the source of the bug?
common
Is this a regression?
No (it's like this since forever, the ngComponentOutlet directive was created before angular could check for strictNullChecks)
Description
<ng-container *ngComponentOutlet="null"></ng-container> throws
error TS2322: Type 'null' is not assignable to type 'Type<any>'.
even though the directive is capable of handling falsy values: https://github.com/angular/angular/blob/master/packages/common/src/directives/ng_component_outlet.ts#L99
This forces you to use any if you use ngComponentOutlet & strict null checks to render a component that is optional.
Please change
- @Input() ngComponentOutlet!: Type<any>;
+ @Input() ngComponentOutlet?: Type<any>;Please provide the environment you discovered this bug in (run ng version)
angular 13.3.4
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P3An issue that is relevant to core functions, but does not impede progress. Important, but not urgentAn issue that is relevant to core functions, but does not impede progress. Important, but not urgentarea: commonIssues related to APIs in the @angular/common packageIssues related to APIs in the @angular/common packagebugcross-cutting: typesstate: has PR