-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Closed
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functions
Description
Bug, feature request, or proposal:
ListKeyManager activeItem property has a wrong type
What is the expected behavior?
The activeItem property can be undefined in some cases, so the typing should be aware of the undefined as well. Another way would be to handle undefined value and return null then.
What is the current behavior?
The activeItem type is set to T | null, but happens to return undefined.
What are the steps to reproduce?
https://stackblitz.com/edit/angular-material-ticket-active-item-type
What is the use-case or motivation for changing an existing behavior?
In some cases (no value selected, non-existing value selected) the property can be also undefined which is not suggested by typing. Due to that fact, we recently faced a null pointer exception, because we only handled null value.
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
It affects @angular/cdk in version 6.3.0+ for sure, although it looks like the code is quite old, so previous version are probably affected as well.
Metadata
Metadata
Assignees
Labels
P4A relatively minor issue that is not relevant to core functionsA relatively minor issue that is not relevant to core functions