我试图在我的角度项目中使用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;
最佳答案
显然我没有全局安装polylabel。进行npm install polylabel
解决了该问题。
关于javascript - 错误:无法调用类型缺少调用签名的表达式。类型'没有兼容的Cll签名,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/47292302/