我尝试编译离子ts代码时遇到问题。
在汇编transpile
部分的代码时,它失败了,因为
[02:17:56] typescript:... project/node_modules/@types/geojson/index.d.ts,line:142','预期。
L141: id?: string | number;
L143: * Properties associated with this feature.
[02:17:56] typescript:... project/node_modules/@types/geojson/index.d.ts,line:163','预期。
[02:17:56] typescript:... project/node_modules/@types/geojson/index.d.ts,line:164泛型类型'Feature'需要3个类型的参数。
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:605通用类型'Feature'需要3个类型的参数。
nds InternalPolyline {
L606: constructor(latlngs: LatLngExpression[], options?: PolylineOptions);
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:607通用类型'Feature'需要3个类型的参数。
L606: constructor(latlngs: LatLngExpression[], options?: PolylineOptions);
L607: toGeoJSON(): GeoJSONFeature<GeoJSONPolygon | GeoJSONMultiPolygon>;
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:614通用类型'Feature'需要3个类型的参数。
ends Polygon {
L615: constructor(latLngBounds: LatLngBoundsExpression, options?: PolylineOptions);
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:616泛型类型'Feature'需要3个类型的参数。
L615: constructor(latLngBounds: LatLngBoundsExpression, options?: PolylineOptions);
16: setBounds(latLngBounds: LatLngBoundsExpression): this;
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:634泛型类型'Feature'需要3个类型的参数。
L633: options: CircleMarkerOptions;
L634: feature?: GeoJSONFeature<GeoJSONPoint>;
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:641泛型类型'Feature'需要3个类型的参数。
L640: constructor(latlng: LatLngExpression, options?: CircleMarkerOptions);
L641: constructor(latlng: LatLngExpression, radius: number, options?: CircleMarkerOptions); // deprecated!
L642: getBounds(): LatLngBounds;
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:689泛型类型'FeatureCollection'需要3个类型的参数。
L690: * Removes the layer with the given internal ID or the given layer from the group.
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:689泛型类型'Feature'需要3个类型的参数。
L690: * Removes the layer with the given internal ID or the given layer from the group.
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:743泛型类型'FeatureCollection'需要3个类型的参数。
L742: function layerGroup(layers: Layer[]): LayerGroup;
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:744泛型类型'Feature'需要3个类型的参数。
L742: function layerGroup(layers: Layer[]): LayerGroup;
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:783泛型类型'Feature'需要3个类型的参数。
L782: * feature and its LatLng.
L784: * The default is to spawn a default Marker:
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:799泛型类型'Feature'需要3个类型的参数。
L798: * The default value is to not override any defaults:
L800: * ```
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:825通用类型'Feature'需要3个类型的参数。
L826: * function (geoJsonFeature) {
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:838泛型类型'Feature'需要3个类型的参数。
L837: coordsToLatLng?(coords: [number, number] | [number, number, number]): LatLng; // check if LatLng has an altitude property
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:856泛型类型'Feature'需要3个类型的参数。
L855: static coordsToLatLng(coords: [number, number] | [number, number, number]): LatLng;
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:890通用类型'Feature'需要3个类型的参数。
L889: addData(data: GeoJSONGeoJsonObject): Layer;
[02:17:56] typescript:... project/node_modules/@types/leaflet/index.d.ts,line:890通用类型'Feature'需要3个类型的参数。
L889: addData(data: GeoJSONGeoJsonObject): Layer;
错误:无法在project \ node_modules \ @ionic \ app-的新BuildError(project \ node_modules \ @ionic \ app-scripts \ dist \ util \ errors.js:16:28)的BuildError.Error(native)上转换程序scripts \ dist \ transpile.js:137:20 at transpileWorker(project \ node_modules \ @ionic \ app-scripts \ dist \ transpile.js:103:12)at Object.transpile(project \ node_modules \ @ionic \ app-scripts \ dist \ transpile.js:61:12)在project \ node_modules \ @ionic \ app-scripts \ dist \ build下的buildProject(project \ node_modules \ @ionic \ app-scripts \ dist \ build.js:97:78)的.js:47:16
有谁知道如何解决这个问题?
问题出在package.json
,"@types/leaflet": "1.5.9"
包括更新版本的"@types/geojson"
,
所以我需要自己包括"@types/geojson"
并设置这样的特定版本:"@types/geojson": "1.0.5"
。