img-mapper/react-img-mapper

Type '{ name: string; areas: string; }' is not assignable to type 'Map'

Closed this issue · 1 comments

Describe the bug
There's an error on the map parameter of the ImageMapper component: "Type '{ name: string; areas: string; }' is not assignable to type 'Map'. Types of property 'areas' are incompatible. Type 'string' is not assignable to type 'MapAreas[]'."

To Reproduce
Use <ImageMapper src{URL} map={MAP} /> with the example JSON from the npm page: https://raw.githubusercontent.com/img-mapper/react-docs/master/src/assets/example.json

Error Stack
Type '{ name: string; areas: string; }' is not assignable to type 'Map'. Types of property 'areas' are incompatible. Type 'string' is not assignable to type 'MapAreas[]'.

Expected behavior
Map should work

Screenshots
Screenshot 2023-02-28 at 15 51 22

Desktop (please complete the following information):

  • OS: macOS Ventura
  • Browser: Chrome
  • Version: 110

Hello @jasymons, areas is JSON and you need to copy it from the example.json and paste it there

Sample Codesandbox: https://codesandbox.io/s/spring-monad-vyfltk?file=/src/App.js

Please check the docs: https://img-mapper.github.io/react-docs/?path=/story/examples-simple--simple

image