For context: I'm using react-map-gl (https://visgl.github.io/react-map-gl/), React, Vite, and typescript. I'm importing data from a json file like this:
import mapStyle from '../../assets/styles/outdoor.json';
I'm then using it in a react-map-gl Map instance (https://visgl.github.io/react-map-gl/docs/api-reference/map) like this:
<Map
id="mainMap"
mapStyle={mapStyle}
>
...
</Map>
My mapStyle should be conform to the style specification (and thus the typescript type definition) because I've generated it by using a tool. But, I'm getting a typescript error, see the message below.
The error says Types of property '"version"' are incompatible. and Type 'number' is not assignable to type '8'.. I'm not sure why this is a problem. In my json, the version field is like this:
{
"version": 8,
...
}
The reason the version field is failing is probably because it's just the first field in the json file. But, why can this 8 not be assigned to number?
React component that wraps the base library's Map class (Mapbox | Maplibre). This is also the default export from react-map-gl.