Incompatible types on drawOptions
mactep opened this issue · 2 comments
mactep commented
I'm facing some errors when passing the drawOptions
object. The code works although the console show some errors about incompatible types. I got those errors even when using the drawOptions
provided in the README.
error TS2322: Type '{ position: string; draw: { marker: { icon: L.Icon<L.IconOptions>; }; polyline: boolean; circle: { shap
eOptions: { color: string; }; }; rectangle: { shapeOptions: { color: string; }; }; }; edit: { featureGroup: L.FeatureGroup<...>; }; }' is not assignable to type 'DrawConstruc
torOptions'.
Types of property 'position' are incompatible.
Type 'string' is not assignable to type 'ControlPosition'.
9 [leafletDrawOptions]="drawOptions"
If i remove that line I get another error.
error TS2322: Type '{ draw: { marker: { icon: L.Icon<L.IconOptions>; }; polyline: boolean; circle: { shapeOptions: { color:
string; }; }; rectangle: { shapeOptions: { color: string; }; }; }; edit: { featureGroup: L.FeatureGroup<any>; }; }' is not assignable to type 'DrawConstructorOptions'.
The types of 'draw.polyline' are incompatible between these types.
Type 'boolean' is not assignable to type 'false | PolylineOptions'.
9 [leafletDrawOptions]="drawOptions"
Am I missing something here?
Thank you!
dhutaryan commented
I have the same issue Type 'boolean' is not assignable to type 'false | PolylineOptions'
dhutaryan commented
I've found a solution: set a type as Control.DrawConstructorOptions
to your drawOptions