apache / apache/echarts

typeScript 下 echarts.registerMap,提示错误,怎么解决

Open
#15,527 18 comments 2 reactions 0 assignees View on GitHub
bug difficulty: easy pending typescript
Dominant language
TypeScript
Stars
67.3k
Forks
19.8k
Avg merge
11d 14h
Merged PRs (30d)
8

Description

### Version
5.1.2

### Steps to reproduce
import * as echarts from 'echarts/core';
import chinaMap from './china.json';

echarts.registerMap('china', chinaMap);

提示报错 类型“{ type: string; features: ({ type: string; properties: { id: string; size: string; name: string; cp: number[]; childNum: number; }; geometry: { type: string; coordinates: number[][][]; }; } | { type: string; properties: { ...; }; geometry: { ...; }; })[]; }”的参数不能赋给类型“MapInput | GeoJSONSourceInput”的参数。
不能将类型“{ type: string; features: ({ type: string; properties: { id: string; size: string; name: string; cp: number[]; childNum: number; }; geometry: { type: string; coordinates: number[][][]; }; } | { type: string; properties: { ...; }; geometry: { ...; }; })[]; }”分配给类型“GeoJSONCompressed”。
属性“type”的类型不兼容。
不能将类型“string”分配给类型“"FeatureCollection"”。

### What is expected?
怎么才能不报错

### What is actually happening?
希望知道引入什么类型会不报错

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.