JavaEar 专注于收集分享传播有价值的技术资料

error :Cannot invoke an expression whose type lacks a call signature. Type 'has no compatible c ll signatures

I am trying to use https://github.com/mapbox/polylabel in my angular project and when I try to run ng server,the build fails with following error

error TS2349: Cannot invoke an expres ion whose type lacks a call signature. Type node_modules/@types/polylabel/index"'has no compatible c ll signatures.

Following is the code for index.ts

    // Type definitions for polylabel 1.0
   // Project: https://github.com/mapbox/polylabel

    // Definitions by: Denis Carriere <https://github.com/DenisCarriere>
    // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

    /**
     * Polylabel returns the pole of inaccessibility coordinate in [x, y] format.
     *
     * @param polygon - Given polygon coordinates in GeoJSON-like format
     * @param precision - Precision (1.0 by default)
     * @param debug - Debugging for Console
     * @example
     * var p = polylabel(polygon, 1.0);
     */
    declare function polylabel(polygon: number[][][], precision?: number, debug?: boolean): number[];
    declare namespace polylabel {}
    export default polylabel;

1个回答

    最佳答案
  1. Apparently I didn't have polylabel installed globally. Doing npm install polylabel fixed the issue.