SuperRay3 edited a comment on issue #15527: URL: https://github.com/apache/echarts/issues/15527#issuecomment-962399027
I think it's not a mistake of echarts. According to the prompt, we can find the main problem is "The type "string" cannot be assigned to the type ""FeatureCollection""". After that we can jump to the type declaration in which file name called `shared.d.ts` whose path is `echarts/types/dist/shared.d.ts` If you regist map by using GeoJSON, the type were limited by `GeoJSONFeatureCollection` `GeoJSONFeature` and `GeoJSONGeometry`. Inspect the data in own code was inferred to be string by typescript, but echarts declare it as a literal "FeatureCollection". **Solution:** Add `as const` assertions to the field which were defined as literal. For example: ```json { type: 'FeatureCollection' as const, features: [ { id: '710000', type: 'Feature' as const, geometry: { type: 'MultiPolygon' as const, coordinates: [ ...... ], encodeOffsets: [ ...... ], }, properties: { cp: [121.509062, 25.044332], name: '', childNum: 6 }, }, ] } ``` @Ovilia Is my solution correct? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@echarts.apache.org For additional commands, e-mail: commits-h...@echarts.apache.org