首页 > 解决方案 > 在打字稿中导入超集群时出错(TypeError:无法设置未定义的属性“选项”)

问题描述

当我在打字稿中导入超集群时,我遇到了这个错误。请随意发表评论。

ExceptionsManager.js:86 TypeError: Cannot set property 'options' of undefined

    This error is located at:
        in App (at renderApplication.js:40)
        in RCTView (at View.js:35)
        in View (at AppContainer.js:98)
        in RCTView (at View.js:35)
        in View (at AppContainer.js:115)
        in AppContainer (at renderApplication.js:39)

更新

当程序执行以下函数时,我得到了异常(ios模拟器中的警报)。

const cluster = supercluster({
        radius: 40,
        maxZoom: 16,
    });

在此处输入图像描述

标签: typescriptreact-nativereact-native-maps

解决方案


幸运的是,安装@types/supercluster后,错误消失了。

yarn add @types/supercluster

or 

npm install --save @types/supercluster

推荐阅读