nimiq / qr-scanner

Lightweight Javascript QR Code Scanner
https://nimiq.github.io/qr-scanner/demo
MIT License
2.35k stars 509 forks source link

Typescript error with React + eslint #229

Open stephaneb74 opened 1 year ago

stephaneb74 commented 1 year ago

The following code returns a typescript error when adding options as the third argument:

"TS2769: No overload matches this call. The last overload gave the following error. Argument of type '{ highlightScanRegion: boolean; highlightCodeOutline: boolean; }' is not assignable to parameter of type 'number'."

Note that the highlighting options do work even though it throws a TS error.

const qrScannerOptions = { highlightScanRegion: true, highlightCodeOutline: true, }

const qrScanner = new QrScanner(videoRef.current, (result: string) => { console.log(result) }, qrScannerOptions);