Adding a GeoJSON layer to a Leaflet map in TypeScript has some difference from that in JavaScript.
It’s because the GeoJSON is typed in TypeScript and the type declaration of Leaflet adopts it. So whenever you construct the GeoJSON object in TypeScript, it’s important to declare the type of the variable as GeoJSON type:
1 | // it's necessary to tell variable type |
For more about the specification and example, take a look at the GeoJSON type definition.