【问题标题】:error :Cannot invoke an expression whose type lacks a call signature. Type 'has no compatible c ll signatures错误:无法调用类型缺少调用签名的表达式。类型 ' 没有兼容的 c ll 签名
【发布时间】:2017-11-22 20:59:59
【问题描述】:

我正在尝试在我的 Angular 项目中使用 https://github.com/mapbox/polylabel,当我尝试运行 ng 服务器时,构建失败并出现以下错误

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.

下面是 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;

【问题讨论】:

    标签: javascript angular typescript


    【解决方案1】:

    显然我没有全局安装 polylabel。执行npm install polylabel 解决了这个问题。

    【讨论】:

      猜你喜欢
      • 2020-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-01-26
      • 1970-01-01
      • 1970-01-01
      • 2017-10-11
      • 2019-10-08
      相关资源
      最近更新 更多