@@ -386,24 +386,48 @@ export class CdkListbox<T = unknown>
386
386
* Toggle the selected state of the given option.
387
387
* @param option The option to toggle
388
388
*/
389
- toggle ( option : CdkOption < T > | T ) {
390
- this . selectionModel ( ) . toggle ( option instanceof CdkOption ? option . value : option ) ;
389
+ toggle ( option : CdkOption < T > ) {
390
+ this . toggleValue ( option . value ) ;
391
+ }
392
+
393
+ /**
394
+ * Toggle the selected state of the given value.
395
+ * @param value The value to toggle
396
+ */
397
+ toggleValue ( value : T ) {
398
+ this . selectionModel ( ) . toggle ( value ) ;
391
399
}
392
400
393
401
/**
394
402
* Select the given option.
395
403
* @param option The option to select
396
404
*/
397
- select ( option : CdkOption < T > | T ) {
398
- this . selectionModel ( ) . select ( option instanceof CdkOption ? option . value : option ) ;
405
+ select ( option : CdkOption < T > ) {
406
+ this . selectValue ( option . value ) ;
407
+ }
408
+
409
+ /**
410
+ * Select the given value.
411
+ * @param value The value to select
412
+ */
413
+ selectValue ( value : T ) {
414
+ this . selectionModel ( ) . select ( value ) ;
399
415
}
400
416
401
417
/**
402
418
* Deselect the given option.
403
419
* @param option The option to deselect
404
420
*/
405
- deselect ( option : CdkOption < T > | T ) {
406
- this . selectionModel ( ) . deselect ( option instanceof CdkOption ? option . value : option ) ;
421
+ deselect ( option : CdkOption < T > ) {
422
+ this . deselectValue ( option . value ) ;
423
+ }
424
+
425
+ /**
426
+ * Deselect the given value.
427
+ * @param value The value to deselect
428
+ */
429
+ deselectValue ( value : T ) {
430
+ this . selectionModel ( ) . deselect ( value ) ;
407
431
}
408
432
409
433
/**
0 commit comments