Reactjs 反应本机类型脚本错误:模块'&引用;“反应自然”';没有导出的成员';外观';

Reactjs 反应本机类型脚本错误:模块'&引用;“反应自然”';没有导出的成员';外观';,reactjs,typescript,react-native,Reactjs,Typescript,React Native,我最近在我的应用程序中实现了暗模式,但在使用npm build构建npm包时出现了一个错误。代码是有效的,但是有没有办法或理由删除此错误 错误 src/ContactActionSheet.tsx:3:10 - error TS2305: Module '"react-native"' has no exported member 'Appearance'. 3 import { Appearance, Dimensions, StyleSheet, Text, View

我最近在我的应用程序中实现了暗模式,但在使用
npm build
构建npm包时出现了一个错误。代码是有效的,但是有没有办法或理由删除此错误

错误

src/ContactActionSheet.tsx:3:10 - error TS2305: Module '"react-native"' has no exported member 'Appearance'.

3 import { Appearance, Dimensions, StyleSheet, Text, View, Linking, TouchableOpacity } from 'react-native';
JSX

// Imports: Dependencies
import { Appearance, Dimensions, StyleSheet, Text, View, Linking, TouchableOpacity } from 'react-native';

// Dark Mode
const colorScheme = Appearance.getColorScheme();

问题在于需要更新npm包
@types/react native

感谢您的后续回复。在检查了我使用的版本后,我发现我甚至没有添加
@types/react native
模块。一旦我补充了这一点,我的问题就解决了。奇怪的是,如果你用TypeScript启动一个项目,它甚至不能保证有这种依赖关系。

这取决于程序包。一些NPM包具有内置类型,但其他NPM包具有单独的
@types/
包这里有一些单独类型包的示例:
@testing library/jest dom
@types/jest
@types/react redux
@types/react router dom
@types/redux logger