'azure-maps-controls' and 'azure-maps-drawing-tools' type error when building with strict mode

max rose 10 Reputation points
2023-02-18T11:48:51.3766667+00:00

The npm azure-maps-controls package is broken when using strict mode for typescript compilation. This is due to

 export abstract class ControlBase<T = any> extends internal.EventEmitter<T> implements Control { /* Type definition */ }

The error is due to internal.EventEmitter constraining T to T extends internal.EventArgs so this constraint also needs to be applied to ControlBase<T extends intenral.EventArgs = any>

There is another type error in azure-maps-drawing-tools in the type definition of DrawingManager the definition of public edit(shape: azmaps.Shape) is missing a return type. As this method does not return anything it should be updated to public edit(shape: azmaps.Shape): void

Due to the issues neither of the packages will compile when using Typescript in strict mode, unless skipLibCheck is set to false in the tsconfig file.

Apologies if this is the wrong place to put this but I don't seem to be able to find a bug tracker for either of these packages that I can find I am just putting this here.

Azure Maps
Azure Maps
An Azure service that provides geospatial APIs to add maps, spatial analytics, and mobility solutions to apps.
833 questions
{count} vote

1 answer

Sort by: Most helpful
  1. QuantumCache 20,366 Reputation points Moderator
    2023-02-21T03:59:20.39+00:00

    Hello max rose, Community SME's on this topic or our team will review your scenario and circle back at the possible earliest time. 

    Meanwhile did you try the below suggestions!!!
    (as long as skipLibCheck is set to false in the tsconfig file)

    public edit(shape: azmaps.Shape): void {
      // Method implementation
    }
    
    export abstract class ControlBase<T extends 
      // Type definition
    }
    

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.