@@ -386,24 +386,48 @@ export class CdkListbox<T = unknown>
386386 * Toggle the selected state of the given option.
387387 * @param option The option to toggle
388388 */
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 ) ;
391399 }
392400
393401 /**
394402 * Select the given option.
395403 * @param option The option to select
396404 */
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 ) ;
399415 }
400416
401417 /**
402418 * Deselect the given option.
403419 * @param option The option to deselect
404420 */
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 ) ;
407431 }
408432
409433 /**
0 commit comments