Skip to content

Commit 903b1ef

Browse files
committed
fixup! fix(cdk-experimental/listbox): address comments
1 parent 6c26bf4 commit 903b1ef

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

src/cdk/collections/selection-model.ts

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,9 @@ export class SelectionModel<T> {
5858
* Selects a value or an array of values.
5959
* @param values The values to select
6060
* @return Whether the selection changed as a result of this call
61+
* @breaking-change 16.0.0 make return type boolean
6162
*/
62-
select(...values: T[]) {
63+
select(...values: T[]): boolean | void {
6364
this._verifyValueAssignment(values);
6465
values.forEach(value => this._markSelected(value));
6566
const changed = this._hasQueuedChanges();
@@ -71,8 +72,9 @@ export class SelectionModel<T> {
7172
* Deselects a value or an array of values.
7273
* @param values The values to deselect
7374
* @return Whether the selection changed as a result of this call
75+
* @breaking-change 16.0.0 make return type boolean
7476
*/
75-
deselect(...values: T[]) {
77+
deselect(...values: T[]): boolean | void {
7678
this._verifyValueAssignment(values);
7779
values.forEach(value => this._unmarkSelected(value));
7880
const changed = this._hasQueuedChanges();
@@ -84,8 +86,9 @@ export class SelectionModel<T> {
8486
* Sets the selected values
8587
* @param values The new selected values
8688
* @return Whether the selection changed as a result of this call
89+
* @breaking-change 16.0.0 make return type boolean
8790
*/
88-
setSelection(...values: T[]): boolean {
91+
setSelection(...values: T[]): boolean | void {
8992
this._verifyValueAssignment(values);
9093
const oldValues = this.selected;
9194
const newSelectedSet = new Set(values);
@@ -102,8 +105,9 @@ export class SelectionModel<T> {
102105
* Toggles a value between selected and deselected.
103106
* @param value The value to toggle
104107
* @return Whether the selection changed as a result of this call
108+
* @breaking-change 16.0.0 make return type boolean
105109
*/
106-
toggle(value: T) {
110+
toggle(value: T): boolean | void {
107111
return this.isSelected(value) ? this.deselect(value) : this.select(value);
108112
}
109113

@@ -112,8 +116,9 @@ export class SelectionModel<T> {
112116
* @param flushEvent Whether to flush the changes in an event.
113117
* If false, the changes to the selection will be flushed along with the next event.
114118
* @return Whether the selection changed as a result of this call
119+
* @breaking-change 16.0.0 make return type boolean
115120
*/
116-
clear(flushEvent = true) {
121+
clear(flushEvent = true): boolean | void {
117122
this._unmarkAll();
118123
const changed = this._hasQueuedChanges();
119124
if (flushEvent) {

0 commit comments

Comments
 (0)