@@ -15,9 +15,9 @@ import {
1515
1616/** Util class to help with scan type selection in scanner class. */
1717export class ScanTypeSelector {
18- private supportedScanTypes : Array < Html5QrcodeScanType > ;
18+ private supportedScanTypes : readonly [ Html5QrcodeScanType , ... Array < Html5QrcodeScanType > ] ;
1919
20- constructor ( supportedScanTypes ?: Array < Html5QrcodeScanType > | [ ] ) {
20+ constructor ( supportedScanTypes ?: ReadonlyArray < Html5QrcodeScanType > | [ ] ) {
2121 this . supportedScanTypes = this . validateAndReturnScanTypes (
2222 supportedScanTypes ) ;
2323 }
@@ -65,8 +65,8 @@ export class ScanTypeSelector {
6565 * Fails early if the config values is incorrectly set.
6666 */
6767 private validateAndReturnScanTypes (
68- supportedScanTypes ?:Array < Html5QrcodeScanType > ) :
69- Array < Html5QrcodeScanType > {
68+ supportedScanTypes ?:ReadonlyArray < Html5QrcodeScanType > ) :
69+ readonly [ Html5QrcodeScanType , ... Array < Html5QrcodeScanType > ] {
7070 // If not set, use the default values and order.
7171 if ( ! supportedScanTypes || supportedScanTypes . length === 0 ) {
7272 return Html5QrcodeConstants . DEFAULT_SUPPORTED_SCAN_TYPE ;
@@ -88,7 +88,7 @@ export class ScanTypeSelector {
8888 }
8989 }
9090
91- return supportedScanTypes ;
91+ return supportedScanTypes as [ Html5QrcodeScanType , ... Array < Html5QrcodeScanType > ] ;
9292 }
9393 //#endregion
9494}
0 commit comments