Integrating a JavaScript library into Typescript
When I use this function in JavaScript, it works perfectly:
_clickHandler() {
TouchID.isSupported()
.then(authenticate)
.catch(error => {
AlertIOS.alert('TouchID not supported');
});
}
However, when attempting to use it in Typescript:
import * as TouchID from 'react-native-touch-id';
function FingerPrintCheck() {
console.log('altered');
TouchID.isSupported()
.then(authenticate)
.catch((error : any) => {
AlertIOS.alert('TouchID not supported');
});
}
An error is encountered:
The issue reported is: "TouchID.isSupported is not a function"
So, why is Typescript failing to recognize the function? Do I need to instantiate a parameter or perform some other action?
Edit: If I import as suggested:
import TouchID from "react-native-touch-id";
I will receive the following error message:
[ts] Module ''react-native-touch-id'' has no default export