gpt4 book ai didi

javascript - typescript XXX.isSupported 不是函数

转载 作者:行者123 更新时间:2023-11-30 20:37:37 25 4
gpt4 key购买 nike


上实现JS库 typescript

如果我在 JS 中使用这个函数,它工作正常

_clickHandler() {
TouchID.isSupported()
.then(authenticate)
.catch(error => {
AlertIOS.alert('TouchID not supported');
});

但是在 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');
});
}

我得到错误:

TouchID.isSupported is not a function

那么为什么 TS 不识别这个函数呢?我需要实例化参数还是做类似的事情

编辑:如果我导入为

import TouchID from "react-native-touch-id";

我会得到:

[ts] Module ''react-native-touch-id'' has no default export

最佳答案

TouchID 导入为

import TouchID from "react-native-touch-id";

关于javascript - typescript XXX.isSupported 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49642943/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com