From 083869da91762d1ef3a171106cfd5d7231e78f6d Mon Sep 17 00:00:00 2001 From: jaywcjlove <398188662@qq.com> Date: Mon, 24 Jun 2024 01:34:05 +0800 Subject: [PATCH] type: fix type error. --- package.json | 2 ++ packages/api-loader/src/index.tsx | 4 ++++ packages/canvas-layer/src/index.tsx | 2 ++ packages/circle/src/index.tsx | 2 ++ packages/control/src/index.tsx | 2 ++ packages/copyright-control/src/index.tsx | 1 + packages/curve-line/src/index.tsx | 1 + packages/custom-overlay/src/index.tsx | 2 ++ packages/drawing-manager/src/index.tsx | 1 + packages/geolocation-control/src/index.tsx | 1 + packages/ground-overlay/src/index.tsx | 1 + packages/info-window/src/index.tsx | 1 + packages/label/src/index.tsx | 1 + packages/marker/src/index.tsx | 1 + packages/navigation-control/src/index.tsx | 1 + packages/overview-map-control/src/index.tsx | 1 + packages/panorama-control/src/index.tsx | 1 + packages/point-collection/src/index.tsx | 1 + packages/polygon/src/index.tsx | 1 + packages/polyline/src/index.tsx | 1 + packages/require-script/src/index.tsx | 1 + packages/scale-control/src/index.tsx | 1 + packages/tile-layer/src/index.tsx | 1 + packages/type-control/src/index.tsx | 1 + packages/with-map/src/index.tsx | 1 + tsconfig.json | 2 +- 26 files changed, 34 insertions(+), 1 deletion(-) diff --git a/package.json b/package.json index 1846dbc73..11c5e296a 100644 --- a/package.json +++ b/package.json @@ -85,6 +85,8 @@ "website" ], "devDependencies": { + "@types/react": "~18.2.16", + "@types/react-dom": "~18.2.7", "@babel/runtime": "^7.18.9", "@kkt/ncc": "~1.1.0", "compile-less-cli": "~1.9.0", diff --git a/packages/api-loader/src/index.tsx b/packages/api-loader/src/index.tsx index 49cf94c52..68a2c9cdd 100644 --- a/packages/api-loader/src/index.tsx +++ b/packages/api-loader/src/index.tsx @@ -1,11 +1,15 @@ +/// + /** * 初始化和加载baidu地图 */ import React from 'react'; import { requireScript } from '@uiw/react-baidu-map-utils'; +import '@uiw/react-baidu-map-types'; declare global { interface Window { + BMap: any; [index: string]: () => any; // or just any } } diff --git a/packages/canvas-layer/src/index.tsx b/packages/canvas-layer/src/index.tsx index bc1c1ddb6..d3dbfe230 100644 --- a/packages/canvas-layer/src/index.tsx +++ b/packages/canvas-layer/src/index.tsx @@ -1,3 +1,5 @@ +/// + import React, { useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useCanvasLayer, CanvasLayerResult } from './useCanvasLayer'; diff --git a/packages/circle/src/index.tsx b/packages/circle/src/index.tsx index 75f5df404..1a6a38d1f 100644 --- a/packages/circle/src/index.tsx +++ b/packages/circle/src/index.tsx @@ -1,3 +1,5 @@ +/// + import React, { useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useCircle } from './useCircle'; diff --git a/packages/control/src/index.tsx b/packages/control/src/index.tsx index 69377825b..0ca276827 100644 --- a/packages/control/src/index.tsx +++ b/packages/control/src/index.tsx @@ -1,3 +1,5 @@ +/// + import React, { useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useControl } from './useControl'; diff --git a/packages/copyright-control/src/index.tsx b/packages/copyright-control/src/index.tsx index 3e194df11..327116751 100644 --- a/packages/copyright-control/src/index.tsx +++ b/packages/copyright-control/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useImperativeHandle, Fragment } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useCopyrightControl } from './useCopyrightControl'; diff --git a/packages/curve-line/src/index.tsx b/packages/curve-line/src/index.tsx index 8c79860db..bf734c7a2 100644 --- a/packages/curve-line/src/index.tsx +++ b/packages/curve-line/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useEffect, useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useCurveLine } from './useCurveLine'; diff --git a/packages/custom-overlay/src/index.tsx b/packages/custom-overlay/src/index.tsx index 25224ce30..f0f061127 100644 --- a/packages/custom-overlay/src/index.tsx +++ b/packages/custom-overlay/src/index.tsx @@ -1,3 +1,5 @@ +/// + import React, { useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useCustomOverlay } from './useCustomOverlay'; diff --git a/packages/drawing-manager/src/index.tsx b/packages/drawing-manager/src/index.tsx index f0ec14a95..9c7ea9965 100644 --- a/packages/drawing-manager/src/index.tsx +++ b/packages/drawing-manager/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useImperativeHandle } from 'react'; import { MapChildProps } from '@uiw/react-baidu-map-map'; import { useDrawingManager } from './useDrawingManager'; diff --git a/packages/geolocation-control/src/index.tsx b/packages/geolocation-control/src/index.tsx index b0c915636..da0e29204 100644 --- a/packages/geolocation-control/src/index.tsx +++ b/packages/geolocation-control/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useGeolocationControl } from './useGeolocationControl'; diff --git a/packages/ground-overlay/src/index.tsx b/packages/ground-overlay/src/index.tsx index c2625a18a..93c01af7f 100644 --- a/packages/ground-overlay/src/index.tsx +++ b/packages/ground-overlay/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useGroundOverlay } from './useGroundOverlay'; diff --git a/packages/info-window/src/index.tsx b/packages/info-window/src/index.tsx index 7be274491..8f2837236 100644 --- a/packages/info-window/src/index.tsx +++ b/packages/info-window/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { Fragment, useEffect, useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useInfoWindow } from './useInfoWindow'; diff --git a/packages/label/src/index.tsx b/packages/label/src/index.tsx index c48dc9a16..650391725 100644 --- a/packages/label/src/index.tsx +++ b/packages/label/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { CSSProperties, useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useLabel } from './useLabel'; diff --git a/packages/marker/src/index.tsx b/packages/marker/src/index.tsx index 297b8dd2c..deceaad97 100644 --- a/packages/marker/src/index.tsx +++ b/packages/marker/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useEffect, useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useMarker } from './useMarker'; diff --git a/packages/navigation-control/src/index.tsx b/packages/navigation-control/src/index.tsx index b83d2f36e..7ff95a6e3 100644 --- a/packages/navigation-control/src/index.tsx +++ b/packages/navigation-control/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useNavigationControl } from './useNavigationControl'; diff --git a/packages/overview-map-control/src/index.tsx b/packages/overview-map-control/src/index.tsx index 97af37a66..fc4bacac9 100644 --- a/packages/overview-map-control/src/index.tsx +++ b/packages/overview-map-control/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useOverviewMapControl } from './useOverviewMapControl'; diff --git a/packages/panorama-control/src/index.tsx b/packages/panorama-control/src/index.tsx index 85ea32b6a..312ec138f 100644 --- a/packages/panorama-control/src/index.tsx +++ b/packages/panorama-control/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { usePanoramaControl } from './usePanoramaControl'; diff --git a/packages/point-collection/src/index.tsx b/packages/point-collection/src/index.tsx index d028c396d..33b95c57a 100644 --- a/packages/point-collection/src/index.tsx +++ b/packages/point-collection/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useEffect, useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { usePointCollection } from './usePointCollection'; diff --git a/packages/polygon/src/index.tsx b/packages/polygon/src/index.tsx index 4e2dfcd1e..1a2086733 100644 --- a/packages/polygon/src/index.tsx +++ b/packages/polygon/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useEffect, useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { usePolygon } from './usePolygon'; diff --git a/packages/polyline/src/index.tsx b/packages/polyline/src/index.tsx index 3d7ce2860..583b83b1b 100644 --- a/packages/polyline/src/index.tsx +++ b/packages/polyline/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useEffect, useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { usePolyline } from './usePolyline'; diff --git a/packages/require-script/src/index.tsx b/packages/require-script/src/index.tsx index 3782f1a73..972a7b995 100644 --- a/packages/require-script/src/index.tsx +++ b/packages/require-script/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { Fragment, useEffect, useState } from 'react'; import { requireScript } from '@uiw/react-baidu-map-utils'; import { RenderProps } from '@uiw/react-baidu-map-map'; diff --git a/packages/scale-control/src/index.tsx b/packages/scale-control/src/index.tsx index ee40e3fa1..96f2b3774 100644 --- a/packages/scale-control/src/index.tsx +++ b/packages/scale-control/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useScaleControl } from './useScaleControl'; diff --git a/packages/tile-layer/src/index.tsx b/packages/tile-layer/src/index.tsx index c54e7d5ac..1ad294b77 100644 --- a/packages/tile-layer/src/index.tsx +++ b/packages/tile-layer/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useImperativeHandle, useEffect } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useTileLayer } from './useTileLayer'; diff --git a/packages/type-control/src/index.tsx b/packages/type-control/src/index.tsx index 2f24ed7d5..d981b4fa0 100644 --- a/packages/type-control/src/index.tsx +++ b/packages/type-control/src/index.tsx @@ -1,3 +1,4 @@ +/// import React, { useImperativeHandle } from 'react'; import { OverlayProps } from '@uiw/react-baidu-map-map'; import { useMapTypeControl } from './useMapTypeControl'; diff --git a/packages/with-map/src/index.tsx b/packages/with-map/src/index.tsx index 25406a403..a803a4130 100644 --- a/packages/with-map/src/index.tsx +++ b/packages/with-map/src/index.tsx @@ -1,3 +1,4 @@ +/// import React from 'react'; import Map, { MapProps } from '@uiw/react-baidu-map-map'; diff --git a/tsconfig.json b/tsconfig.json index 777f98f30..44dcd8538 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -14,7 +14,7 @@ "isolatedModules": true, "declaration": true, "baseUrl": ".", - "jsx": "react", + "jsx": "react-jsx", "noFallthroughCasesInSwitch": true, "noUnusedLocals": true, "experimentalDecorators": true,