| 658 | }; |
| 659 | |
| 660 | const normalizeSoundSettings = ( |
| 661 | value: unknown, |
| 662 | ): ExtensionSettings["sounds"] => { |
| 663 | const sounds = |
| 664 | value && typeof value === "object" |
| 665 | ? (value as Partial<ExtensionSettings["sounds"]>) |
| 666 | : {}; |
| 667 | |
| 668 | return { |
| 669 | enabled: |
| 670 | typeof sounds.enabled === "boolean" |
| 671 | ? sounds.enabled |
| 672 | : defaultSettings.sounds.enabled, |
| 673 | }; |
| 674 | }; |
| 675 | |
| 676 | // Only 3/5/10 are offered in the UI, but any positive integer is accepted so a |
| 677 | // hand-edited or future value is not silently reset to the default. |