-
-
Notifications
You must be signed in to change notification settings - Fork 98
Typescript error: 'MarkerClusterGroup' cannot be used as a JSX component. #133
Comments
Same error here. |
As a workaround I've declared a .d.ts file with the following content:
If you need to pass props to MarkerClusterGroup, you'll have to change this file too. |
Thanks @Silventino, the workaround worked for me |
same error here.. |
same error here, don't know how to work around |
As a workaround I've wrapped the Markers in a javascript-component (without typescript), where I am using the Cluster.
|
thanks a lot @Silventino it worked like a charm! I don't know if someone is still looking to maintain this package and the types, but it could be a good PR to open Again, thanks a lot! |
I think it should be
|
Much better! |
same error here! |
Hey all, The reason for this issue is the fact that this library relies on DefinitelyTyped for its typing, but the DefinitelyTyped definition only provides typing for version 2.0, which relies on The ideal solution would be to convert this library to TypeScript; this would mean type definitions would be provided natively, and would be based on the types for Note that it appears another user has made their own library for marker clusters. EDIT: For those reading this thread later, the library I linked now uses the MIT license and is thus safe to use for closed-source projects. |
Though this library is licensed under GPL, that is not an option for closed-source projects. So having proper typings here is still required |
Tnks @tirli it worked for me this markers clusters very easy |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I was getting an error Non-abstract class 'MarkerClusterGroup' does not implement inherited abstract member 'render' from class 'Component<MarkerClusterGroupOptions, {}>'. ts(2515) so I tweaked @DorianMazur code like this: /**
* Type definitions for react-leaflet-markercluster:^3.0.0-rc1
* Requires '@types/leaflet.markercluster'
*/
declare module 'react-leaflet-markercluster' {
import { Component } from 'preact' // Switch to 'react' if you use it
import { MarkerClusterGroupOptions } from 'leaflet'
export default abstract class MarkerClusterGroup extends Component<MarkerClusterGroupOptions> {}
} |
Thanks @piotr-cz for the snippet. Works fine for me :) |
Hi. |
|
Thanks @piotr-cz
|
Hi, I'm trying to use it with TypeScript but I'm receiving the following error:
The following packages versions are being used:
Anyone has a workaround on this?
The text was updated successfully, but these errors were encountered: