Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error when providing draw options #161

Open
mjpoo opened this issue Jan 10, 2025 · 1 comment
Open

Type error when providing draw options #161

mjpoo opened this issue Jan 10, 2025 · 1 comment

Comments

@mjpoo
Copy link

mjpoo commented Jan 10, 2025

If I specify that a polygon (or other shape such as a circle) should be false in the drawOptions like so:

  drawOptions = {
    draw:{
      polygon: false,
    },
    edit: {
      featureGroup: this.drawnItems,
    }
  };

then the following type error is thrown at [leafletDrawOptions]="drawOptions" in the console:

Type '{ draw: { polygon: boolean; }; edit: { featureGroup: L.FeatureGroup<any>; }; }' is not assignable to type 'DrawConstructorOptions'.
  The types of 'draw.polygon' are incompatible between these types.
    Type 'boolean' is not assignable to type 'false | PolygonOptions | undefined'.ngtsc(2322)
@mjpoo
Copy link
Author

mjpoo commented Jan 13, 2025

If it helps other people for the moment I'm using a workaround to use SCSS to hide the unwanted draw option control:

.leaflet-draw-toolbar{
    .leaflet-draw-draw-polygon {
        display: none;  // Hide the unwanted button
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant