【发布时间】:2023-01-18 19:52:13
【问题描述】:
在我的 TypeScript React Native 移动应用程序中,我试图检测出现在屏幕上的元素。我正在尝试使用许多包,例如 react-native-inview 和 react-native-component-inview,但它们不断抛出与 typescript typing 相关的错误。我该如何解决这些错误,或者是否有其他支持打字稿的方法或软件包可用?
错误:
Could not find a declaration file for module 'react-native-inview'. 'PATH/node_modules/react-native-inview/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/react-native-inview` if it exists or add a new declaration (.d.ts) file containing `declare module 'react-native-inview';`
注意:不存在自动指定类型的包如npm i --save-dev @types/react-native-inview。
【问题讨论】:
标签: react-native