【问题标题】:@types/leaflet not compile at ionic transpile@types/leaflet 不能在 ionic transpile 编译
【发布时间】:2018-06-08 13:45:09
【问题描述】:

我在尝试编译我的 ionic ts 代码时遇到问题。

transpile 部分的代码编译时失败了,因为

[02:17:56] 打字稿:...project/node_modules/@types/geojson/index.d.ts,行:142 ',' 预期。

 L141:  id?: string | number;
 L143:   * Properties associated with this feature.

[02:17:56] 打字稿:...project/node_modules/@types/geojson/index.d.ts,行:163 ',' 预期。

[02:17:56] 打字稿:...project/node_modules/@types/geojson/index.d.ts,行:164 泛型类型“功能”需要 3 个类型参数。

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:605 泛型类型“功能”需要 3 个类型参数。

                              nds InternalPolyline {
 L606:          constructor(latlngs: LatLngExpression[], options?: PolylineOptions);

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:607 泛型类型“功能”需要 3 个类型参数。

 L606:          constructor(latlngs: LatLngExpression[], options?: PolylineOptions);
 L607:          toGeoJSON(): GeoJSONFeature<GeoJSONPolygon | GeoJSONMultiPolygon>;

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:614 泛型类型“功能”需要 3 个类型参数。

                               ends Polygon {
 L615:          constructor(latLngBounds: LatLngBoundsExpression, options?: PolylineOptions);

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:616 泛型类型“功能”需要 3 个类型参数。

 L615:      constructor(latLngBounds: LatLngBoundsExpression, options?: PolylineOptions);
   16:      setBounds(latLngBounds: LatLngBoundsExpression): this;

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:634 泛型类型“功能”需要 3 个类型参数。

 L633:      options: CircleMarkerOptions;
 L634:      feature?: GeoJSONFeature<GeoJSONPoint>;

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:641 泛型类型“功能”需要 3 个类型参数。

 L640:  constructor(latlng: LatLngExpression, options?: CircleMarkerOptions);
 L641:  constructor(latlng: LatLngExpression, radius: number, options?: CircleMarkerOptions); // deprecated!
 L642:  getBounds(): LatLngBounds;

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:689 泛型类型“FeatureCollection”需要 3 个类型参数。

 L690:           * Removes the layer with the given internal ID or the given layer from the group.

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:689 泛型类型“功能”需要 3 个类型参数。

 L690:           * Removes the layer with the given internal ID or the given layer from the group.

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:743 泛型类型“FeatureCollection”需要 3 个类型参数。

 L742:      function layerGroup(layers: Layer[]): LayerGroup;

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:743 泛型类型“功能”需要 3 个类型参数。

 L742:      function layerGroup(layers: Layer[]): LayerGroup;

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:783 泛型类型“功能”需要 3 个类型参数。

 L782:  * feature and its LatLng.
 L784:  * The default is to spawn a default Marker:

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:799 泛型类型“功能”需要 3 个类型参数。

 L798:  * The default value is to not override any defaults:
 L800:  * ```

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:825 泛型类型“功能”需要 3 个类型参数。

 L826:  * function (geoJsonFeature) {

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:838 泛型类型“功能”需要 3 个类型参数。

 L837:          coordsToLatLng?(coords: [number, number] | [number, number, number]): LatLng; // check if LatLng has an altitude property

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:856 泛型类型“功能”需要 3 个类型参数。

 L855:          static coordsToLatLng(coords: [number, number] | [number, number, number]): LatLng;

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:890 泛型类型“功能”需要 3 个类型参数。

 L889:          addData(data: GeoJSONGeoJsonObject): Layer;

[02:17:56] 打字稿:...project/node_modules/@types/leaflet/index.d.ts,行:890 泛型类型“功能”需要 3 个类型参数。

 L889:          addData(data: GeoJSONGeoJsonObject): Layer;

错误:编译程序失败 在 BuildError.Error (本机) 在新的 BuildError (project\node_modules\@ionic\app-scripts\dist\util\errors.js:16:28) 在 project\node_modules\@ionic\app-scripts\dist\transpile.js:137:20 在 transpileWorker (project\node_modules\@ionic\app-scripts\dist\transpile.js:103:12) 在 Object.transpile (project\node_modules\@ionic\app-scripts\dist\transpile.js:61:12) 在 buildProject (project\node_modules\@ionic\app-scripts\dist\build.js:97:78) 在 project\node_modules\@ionic\app-scripts\dist\build.js:47:16

有人知道怎么解决吗?

【问题讨论】:

    标签: typescript ionic-framework types ionic2 leaflet


    【解决方案1】:

    问题出在package.json "@types/leaflet": "1.5.9" 包含较新版本的"@types/geojson"

    所以我只需要自己包含"@types/geojson" 并设置一个特定版本,如下所示:"@types/geojson": "1.0.5"

    【讨论】:

      猜你喜欢
      • 2015-09-18
      • 2018-12-11
      • 2021-03-27
      • 1970-01-01
      • 2021-08-05
      • 2022-08-15
      • 2017-06-12
      • 2021-11-20
      • 1970-01-01
      相关资源
      最近更新 更多