preflower/react-barcode-scanner

Export DetectedBarcode type?

Closed this issue · 2 comments

I could be misunderstanding something but I'm having trouble getting Typescript to pass checks on my use of this library. Using the following very minimal example based on the demo:

import { BarcodeScanner } from 'react-barcode-scanner'
import 'react-barcode-scanner/polyfill'
function QrScanner({onDetect}: {onDetect: (value: string) => void}) {
  const onCapture = (detected) => {
    if (detected) {
      const value = detected.rawValue
      onDetect(value)
    }
  }
  return (
    <BarcodeScanner onCapture={onCapture} />
  )
}

I'd like to declare detected as a DetectedBarcode but it looks like this type is not exported? Happy to be corrected if I'm mistaken.

I will export these types in next version.

Version 2.0.2 has exported type