Trying to figure out the correct typescript definition for react-native-tesseract-ocr (https://github.com/jonathanpalma/react-native-tesseract-ocr)
This is the quick example of it in action:
import RNTesseractOcr from 'react-native-tesseract-ocr';
RNTesseractOcr.startOcr(response.path, "LANG_ENGLISH")
.then((result) => {
this.setState({ ocrResult: result });
console.log("OCR Result: ", result);
})
.catch((err) => {
console.log("OCR Error: ", err);
})
What I've tried is (doesn't work).
declare module "react-native-tesseract-ocr" {
export default class RNTesseractOcr {
startOcr(image: String, lang: String) :Promise<any>;
}
}
Looking to put this into a declarations.d.ts
file, not sure if that changes the syntax.
You've declared that the default export is a class constructor, in other words that the intended usage is
Instead, try this: