我正在使用topojson
将json
文件转换为geofile
,以便d3js
geo api读取;但是,打字稿给我一个错误,说明回调函数返回的数据objects does not exist on type {}
,我不确定如何解决这个问题
d3Data.json('https://s3-us-west-2.amazonaws.com/vida-public/geo/world-topo-min.json', function(error, world) {
if (error) throw error;
svg.insert("path", ".graticule")
//Property objects does not exist on type {}
.datum(topojson.feature(world, world.objects.land))
.attr("class", "land")
.attr("d", path);
svg.insert("path", ".graticule")
//Property objects does not exist on type {}
.datum(topojson.mesh(world, world.objects.countries, function(a, b) { return a !== b; }))
.attr("class", "boundary")
.attr("d", path);
});
答案 0 :(得分:3)
只需将<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<ol class="top-assignee">
<li class ="1st-assignee"></li>
<li class ="2nd-assignee"></li>
<li class="3rd-assignee"></li>
<li class="4th-assignee"></li>
<li class="5th-assignee"></li>
</ol>
参数的类型设置为world
,如下所示:
any
如@Duncan所述,最好将function (error, world: any) {...}
属性转换为您期望的特定类型:
world