I have a react native project running on typescript, is working fine, now I've added a library react-native-fingerprint-scanner from NPM, but I'm having problems calling a function?
So the project works fine on JS:
componentDidMount() {
FingerprintScanner
.isSensorAvailable()
.catch(error => this.setState({ errorMessage: error.message }));
}
But if I call the same way
componentDidMount
On typeScript project, I get:
TypeError: FingerprintScanner.isSensorAvailable is not a function.(In 'FingerprintScanner.isSensorAvailable' is undefined)
Note, I have to import with
const FingerprintScanner = require('react-native-fingerprint-scanner');
because If I import with
import { FingerprintScanner } from 'react-native-fingerprint-scanner';
I get this error:
Could not find a declaration file for module 'react-native-fingerprint-scanner'
So, how to get TS to recognize this function? cheers